HOW TO RETRIEVE A SPECIFIC DIV DATA USING JQUERY AJAX

Jayden Bell

Total Post:110

Points:774
Posted by  Jayden Bell
AJAX 
 1775  View(s)
Ratings:
Rate this:
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!
  1. AVADHESH PATEL

    Post:604

    Points:4228
    Re: How to retrieve a specific div data using jQuery Ajax

    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

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!