jQuery 呼叫後端傳值方式

load()

$( "#id" ).load("url");

$( "#id" ).load("url", {
    param1 : value1,
    param2 : value2
});

$( "#id" ).load("url", 
{
        param1 : value1,
        param2 : value2
    }, 
    function() {
        alert( "success" );
    }
);

get()

$.get({
    url: /*[[ @{/do} ]]*/ null,
    data: { 
	    param: value 
    }
}).then(function(result) {
    
}); 

post()

$.post("url", 
    {
        param1 : value1,
        param2 : value2
    }, 
    function( data ) {
        alert( data.name );
    }, 
    "json"
);

ajax

$.ajax({
    url: "/do",
    type: "post",
    dataType: "text",
    contentType: "application/json",
    data: {
        param1 : value1,
        param2 : value2
    },
    cache: false,
    async: true,
    success: function(data){
        if(data != null){
            var o = JSON.parse(data);
            alert(o.id);
        }
    }
});