jeudi 19 février 2015

get only specific data in success message from ajax


i have an ajax call and i am getting a response from the call. the code is like this:



<div id="flow_#id#~#sid#" style="margin: 0 10px 0 0;float:right;height:150px;" class="code">
<img src="/assets/codes/#code#.jpg" style="max-height: 230px;">
</div>


What i am doing is the response i get from my ajax, i want to replace the contents of the div tag with the value coming from my ajax success


ajax call is like this



$.ajax({
url: 'bc.cfm?ID=' + getID + '&ssID=' + getSID,
type: "GET",
cache: false,
success: function(data){
$("#flow_" + getID + "~" + getSID + " img:last-child").remove();
$("#flow_" + getID + "~" + getSID).html(data);
}
});


But a complete html page is coming in success, i can the img in firebug, but a complete html source is there, how can i extract that img tag and replace with the one which is already there above [the id is going to be same for both for identification, only 1 will be used, we will be removing and adding again]





Aucun commentaire:

Enregistrer un commentaire