How to get jSON response into variable from a jquery script

前端 未结 4 1927
小鲜肉
小鲜肉 2020-12-13 15:00

I am having trouble with my jquery script below, this is a basic stripped down version and even it will not work, I have the php file that the jquery script makes a call to

4条回答
  •  忘掉有多难
    2020-12-13 15:37

    Your PHP array is defined as:

    $arr = array ('resonse'=>'error','comment'=>'test comment here');
    

    Notice the mispelling "resonse". Also, as RaYell has mentioned, you have to use data instead of json in your success function because its parameter is currently data.

    Try editing your PHP file to change the spelling form resonse to response. It should work then.

提交回复
热议问题