I want to send some orders from main page, then in process page, there would be a mysql query, query out many rows of data. But I want return these data into several divs in main page. I tried code here, but this will cause Uncaught TypeError: (return data) has no method 'find', So is it possible do this work in jquery.ajax and How? thanks.
Main page:
$.ajax({
url: "precess",
dataType: "html",
type: 'POST',
data: "process="+code,
success: function(data){
$("#title").html(data.find("#a1"));
$("#content").html(data.find("#a2"));
}
});
<div id="title"></div>
/* some other html codes */
<div id="content"></div>
Process page
<div id="a1">/* something from mysql query */</div>
<div id="a2">/* something from mysql query */</div>
The correct solution is posted already, but you should consider using json for this.
Javascript
PHP