How to retrieve a specific div data using jQuery Ajax

Hi Expert!

How to retrieve a specific div's  data using jQuery and Ajax

My Line of code as following

$(document).ready(function(){
  $("button").click(function(){
    $.ajax({url:"A.asp?mmid=1&umid=2" ,success:function(result){
      $("#adfrnd").html(result);
    }});
  });
});

I am trying to retrieve test div from A.asp page if I include

url:"A.asp?mmid=1&umid=2 #test"

It doeasn't work. Any suggestions?

Thanks in advance!
Last updated:5/11/2013 9:53:05 AM

1 Answers

AVADHESH PATEL
AVADHESH PATEL

Hi!


You can use jQuery to wrap the resulting HTML and then find or similar from within that.

success: function(resultHtml) {
  $(resultHtml).find('.whatever-class').html() // then use this for whatever
}

Answer