Assume I\'m calling search through AJAX. Now I want to call another AJAX on the page that will be loaded by AJAX and can be edited.
Assuming that you have something basically like this structure and jQuery 1.7+
data On the parent page, you need to attach "delegated handlers", which are event handlers placed on parent elements that execute for present or future child elements. And so, assuming that we have a container div id'ed "resultContainer" in which you dump the live data, we attach it handlers: //attach a delegated submit handler on resultContainer for forms $('#resultContainer').on('submit','form',function(event){ //do what you want when an item is edited //"this" inside here is the DOM element form, which fired the submit //prevent the default submit action using event.preventDefault() //$(this).serialize() turns the form data into a serialized query string }); 0 讨论(0) 查看其它3个回答 发布评论: 提交评论 加载中... 验证码 看不清? 提交回复 热议问题
On the parent page, you need to attach "delegated handlers", which are event handlers placed on parent elements that execute for present or future child elements.
And so, assuming that we have a container div id'ed "resultContainer" in which you dump the live data, we attach it handlers:
//attach a delegated submit handler on resultContainer for forms $('#resultContainer').on('submit','form',function(event){ //do what you want when an item is edited //"this" inside here is the DOM element form, which fired the submit //prevent the default submit action using event.preventDefault() //$(this).serialize() turns the form data into a serialized query string });