开发者

Using Ajax and PHP to write to two different HTML

开发者 https://www.devze.com 2022-12-31 02:35 出处:网络
I\'m trying to use Ajax to call a PHP script to write to two different HTML tags. The PHP script generates a string that is unique every time. So, I cannot call the PHP script twice. Are there any cre

I'm trying to use Ajax to call a PHP script to write to two different HTML tags. The PHP script generates a string that is unique every time. So, I cannot call the PHP script twice. Are there any creative ways to write to two different HTML tags using the same call to the script?

To clarify, I do not want the two开发者_StackOverflow中文版 tags to contain the same PHP output. The first tag should contain the PHP output but the second tag should hold a string that was created in the script.


Format the data in the response in a fashion that lets you separate the data into the bits you care about (JSON is good for this). Then deal with it in your XHR callback function (which, like any function, can do as many different things as you like).

0

精彩评论

暂无评论...
验证码 换一张
取 消