2

I have a page which is divided in to many tabs , with each tab pulling data from another pages through ajax.

After the ajax call, i use a .html ( data ) where data is the html of called page to insert it in to the tab. My question is , if the called page has javascript functions , will those be executed and resultant data is sent or just the html page is sent?

Kindly help.

Thanks.

4

2 回答 2

1

是的,只要您指定:

数据类型:“html”,

在你的 ajax 调用中。

来自http://api.jquery.com/jQuery.ajax/

如果指定了 html,则检索数据中的任何嵌入 JavaScript 都会在 HTML 作为字符串返回之前执行。同样,脚本将执行从服务器拉回的 JavaScript,然后什么也不返回。

于 2011-09-09T20:41:08.407 回答
1

服务器返回的内容与页面上显示的内容不同。您收到的文件在 Jquery 接触它之前不会被处理。但是,一旦 Jquery 收到它,脚本就会随后执行。所以不,脚本在 Jquery 收到内容之前不会运行。

于 2011-09-09T20:46:33.250 回答