jQuery each() results to array to php to database -
basically doing making sort of invitation system, user clicks on users , go list, works, can ids of them using each() need pass through jquery ajax php send database notifications. have:
$(".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(){ // relevant code var user_id = $(this).attr("id"); // here }); // & here if(user_id) { $.ajax({ type: "post", //url: "", //data: "", //this array of of ids, (could 1, 100). cache: false, success: function(html){ ///once invitations have been sent database load new div , hide previous one. } }); } } });
if want see i'm trying accomplish go here:
http://www.kithell.com/#/video
usr: phpfreak@yahoo.com pass: phpfreaklogin
it's under group video. (you should automatically directed there once logged in)
you might able use jquery.serialize bundle of form data. also, jquery.post nice shortcut doing post request jquery.ajax
.
a rough example might this:
$.post( '/my-ajax-service.php', $('#myform').serialize(), function(data, txtstatus, jqxhr) { //do stuff });
Comments
Post a Comment