开发者

php and jquery, how to do an ajax call using 2 forms?

开发者 https://www.devze.com 2023-03-16 00:56 出处:网络
i am using this example to create a comment system. So far works great. What i want to do is to add one more form that will insert comments in the database exactly like in that example just use anoth

i am using this example to create a comment system. So far works great.

What i want to do is to add one more form that will insert comments in the database exactly like in that example just use another commentajax.phpwitch ill rename to commentajax1.php in where ill use a different sql statement.

i see the jquery POST $(".submit").click(function() {...} works when a doom element with class="submit" is activated. Will it be开发者_Python百科 enough to create another jquery that is called by another class?

thanks,


Look at this part:

$.ajax({
type: "POST",
url: "commentajax.php",
data: dataString,
cache: false,
success: function(html){
$("ol#update").append(html);
$("ol#update li:last").fadeIn("slow");
$("#flash").hide();
}
});
}return false;
});

It do AJAX to "commentajax.php".

If you create another click event that invoke different AJAX call to different url you will be fine.

0

精彩评论

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