0

here's my code

   $('#loader').hide()
   .ajaxStart(function(){
     $(this).show();
   })
   .ajaxStop(function(){
     $(this).hide();
   });


   $('form#jobsearch').submit(function(){
      $("div.job-search-content").hide();
      $("div#pagination").hide();

       $.ajax({
          type: "POST",
          url: "classes/ajax.simplesearch.php",
          data: $('form#jobsearch').serialize(),
          success: function(data){
          // I DONT" REALLY KNOW WHAT TO DO IN THIS PART 
            $(data).insertAfter('#job-search-headings').html();
              //$("div.job-search-content").show();
          }
       });
        return false;
   });
});

if I hide the job-search-content div, it will show the loader but the problem is, how will I add the retrieved database content under the '#job-search-headings' div ? ....I checked in firebug..I was able to retrieve the correct data..but I wasn't able to display it at front-end :(

3 Answers 3

2

if you want to display the ajax results on the div "job-search-content"

$("div.job-search-content").html(data).show();
Sign up to request clarification or add additional context in comments.

Comments

0

data is the responce from the page you're posting to so if the page returns something like <div>some content</div> change

$(data).insertAfter('#job-search-headings').html();

to

$('#job-search-headings').after(data);

Comments

0

Try something like this:

$('#job-search-headings').after(data);

2 Comments

Should be working, you might have a DIV on .hide() or display: none which contains the data.
how to make the loader stay a bit longer?..i mean, it's too fast..like, i wanna show it to the end user that it is currently loading a data even if it's only trying to fetch only 1 data.. i just want the loader to be shown for about 5 seconds or less ?

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.