Passing javascript code in JSON

后端 未结 2 1314
情话喂你
情话喂你 2021-01-21 05:31

I am making an AJAX call with jQuery to a PHP script that needs to return javascript code embedded in a JSON result for the jQuery code to execute. How do I go about passing jav

2条回答
  •  野的像风
    2021-01-21 06:12

    Two ways:

    1. You'll have to pass it as a string and use eval() on the client side.
    2. You can use JSONP, and instead of doing a call, have your client side script insert a
提交回复
热议问题