AlCode
AlCode

Reputation: 565

Manipulate AJAX function on success

 $.ajax({
        url: "url.com",
        type: "GET",
        success: function (data){


          $(data). //how?

        }
    });

THe data object returns a HTML page, and i just want to get a specific DIV from the data object. I've tried $(data).find('id/class') but it returns just a string. I tried $("div", data); it returns all divs but not the specific one i want with some id. Im out of ideas, anyone can help?

Upvotes: 4

Views: 78

Answers (1)

Sadikhasan
Sadikhasan

Reputation: 18600

In success response of your data you have to parse your HTML and apply filter on that.

var result =  $($.parseHTML(data)).filter("div#your_id"); 

Upvotes: 1

Related Questions