javascript - Jquery AJAX not loading page, despite page existing -


i'm relatively new whole ajax thing , i'm editing script open modal box, , load requested content said box. have following javascript

jquery(document).ready(function($){  $('a[name=modal]').click(function(e) {      e.preventdefault();      var maskheight = $(document).height();     var maskwidth = $(window).width();      //set height , width mask fill whole screen     $('#mask').css({'width':maskwidth,'height':maskheight});       $('#mask').fadeto(600,0.75);       var load_page = $(this).attr('ajax');      //get window height , width     var winh = $(window).height();     var winw = $(window).width();      // set loading html displayed     var loadinghtml = '<center><img src="_img/progress_bar.gif"/></center>';          //set loading bar         $('#placeholder').html(loadinghtml).fadeto(600,1);         $('#placeholder').css('top',  winh/2-$('#placeholder').height()/2);         $('#placeholder').css('left', winw/2-$('#placeholder').width()/2);      // ajax load     $('#ajax').load('_content/' + load_page + '.php', null, function(){           $('#ajax').css('top',  winh/2-$('#ajax').height()/2);         $('#ajax').css('left', winw/2-$('#ajax').width()/2);         $('#ajax').fadeto(600,1);     });     });  $('.window .close').click(function (e) {     e.preventdefault();     $('#mask, #box, #ajax').hide(); });      //if mask clicked $('#mask').click(function () {     $(this).hide();     $('#ajax, #placeholder').hide(); });         

});

and following html,

<div id="mask"></div> <div id="placeholder"></div> <div id="ajax"></div>  

my css also,

    #mask  {   position: absolute;   left: 0;   top: 0;   opacity: 0;   z-index: 9000;   background: url("../_img/mask.png") repeat;   display: none;   overflow: hidden; } #placeholder {     overflow: hidden;     opacity: 0;     position: absolute;     z-index: 9050;     overflow: hidden; } #ajax {     position: absolute;     z-index: 9100;     overflow: hidden;     opacity: 0;     display: none; } 

the script displays loading bar doesn't display modal box ajax content, page exist on localhost. in advance.

i think because site cannot find _content folder may not in same directory javascript file. try ../_content , if doesnt work, try using entire url: http://example.com/a/b/_content/...


Comments

Popular posts from this blog

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -