AJAX request callback using jQuery

后端 未结 5 1015
梦谈多话
梦谈多话 2020-11-21 23:01

I am new to the use of jQuery for handling AJAX, and have written a basic script to get the basics down. Currently I am POSTing an AJAX request to the same file, and I wish

5条回答
  •  情书的邮戳
    2020-11-21 23:35

    You could add die(); after you echo the number if you really want to keep it on the same page. This will terminate the execution of the script. Don't forget to add brackets around the if statement:

    if (isset($num)) {
      echo $num['number'] * 2;
      die();
    }
    

    It is, however, not the most elegant solution.

提交回复
热议问题