Returning a JSON object from PHP in AJAX call?

前端 未结 3 515
旧巷少年郎
旧巷少年郎 2021-01-02 11:30

Here\'s my PHP code called during jQuery AJAX call:



        
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-02 12:04

    In your $.post call, the last argument could be the data-type: json:

    $.post(url, {ID:$('#ddlClients').val()},
        function(Result){
            alert(Result.Address_1);
        },'json'
     );
    

    Everything should work then, as it looks like you are doing everything right.

提交回复
热议问题