php - Jquery ajax return current page html in response -


first, let me i've looked through other similar questions on site , jquery documentation. far, haven't found fixes issue.

i trying html data ajax request every time in response got current page html.

here ajax function.

jquery.ajax({     url:"url function call",     type: "post",     datatype : "html",     headers: {         'content-type': 'application/x-www-form-urlencoded'     },     data: {          qtext: filter_search     },     success:function(data) {         console.log(data);         jquery("#appendhtml").html(data);     },     error : function(data) {} }); 

and here joomla php function have return html

public function gethtmlajax() {     $token = $this->createtoken();     $listdata = $this->getkapsulelist($token);      $html = $this->buildlayout($listdata);     echo $html;     jexit(); } 

i faced same issue, , solved putting die; @ end of ajax page.

(on page passed in url tag of ajax function, i.e. @ end of function call url or in in simple words page on page request sent).


Comments