Get html by ajax 1

Get html by ajax

//your jquery code will be like this:
$.ajax({
      type: 'POST',
      url: $url,
      data: new FormData(this),
      dataType: 'json',
      contentType: false,
      processData:false,//this is a must
      success: function(response){ 
      		$('your_selector').html(response);
      }
});

//php code will be like this
echo '
some html code
'; die();

Here is what the above code is Doing:
1. You are sending the form data to the server using ajax.
2. The server is processing the form data and returning the html code.
3. You are appending the html code to the selector.

Hope this helps.

Similar Posts