Displaying AJAX Response

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nhatmeister
    New Member
    • Jan 2015
    • 1

    Displaying AJAX Response

    I am using AJAX to call a PHP script. The PHP echo back a complete HTML table. How can I display this table as a HTML page ?
  • Exequiel
    Contributor
    • Jul 2012
    • 288

    #2
    You must have a target element where you want to display the output from your ajax. like this.
    Code:
    $.ajax({
    			type: "post",
    			url: "URL",
    			data:{
    				fielddata	:	"fielddata"
    			},
    			success: function(datafromphp)
    			{
    				$("#elementToDisplay").html(datafromphp);
    			}
    		});
    Make sure that the id or class of your element where you want to display is existing.

    Comment

    Working...