【发布时间】:2011-08-15 17:30:36
【问题描述】:
基本上我正在做的是制作一种邀请系统,用户点击用户,他们进入一个列表,一切正常,我可以使用 each() 获取他们的 ID,但我需要通过它jQuery Ajax 到 php 将其发送到数据库以获取通知。这基本上就是我所拥有的:
$(".group-video-create").click(function(){
var url = $(".group-input-url").val();
var exp = /(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
var checked_url = url.match(exp,"<a href='$1'>$1</a>");
if(checked_url)
{
$("#group-input-names li").each(function(){ // This is the relevant code
var user_id = $(this).attr("id"); // Here too
}); // & here
if(user_id)
{
$.ajax({
type: "POST",
//url: "",
//data: "", //this would be an array of all of the ids, (could be 1, could be 100).
cache: false,
success: function(html){
///Once all invitations have been sent to the database it would then load a new div and hide the previous one.
}
});
}
}
});
如果你想看看我想要完成什么,请到这里:
http://www.kithell.com/#/video
usr: PhpFreak@yahoo.com 通过:phpfreaklogin
它在群组视频下。 (您应该在登录后自动定向到那里)
【问题讨论】:
-
jQuery 拼写为“jQuery”,而不是“Jquery”。