Hi
Back again with a problem, I try to make multiple forms but my code is not working and I'm an Ajax beginner. I use jquery 1.4.2, that's my code:
Quote:
$(document).ready(function()
{
$(".comment_submit").click(function(){
var element = $(this);
var Id = element.attr("id");
$('#videoForm'+Id).submit(function(){$('input[type=submit]', this).attr('disabled', 'disabled');});
function sendVIDEO ( ) {
var videoid = $("#videoid"+Id);
var memberid = $("#mem_id"+Id);
var active = $("#active"+Id);
var credits = $("#credits"+Id);
var video_wipit = $("#videoWipit"+Id);
var url = "scripts/video_parse.php";
if (videoid.val() == "") {
$("#videointeractionResults"+Id).html('<img src="images/round_error.png" alt="Error" width="31" height="30" /> Video not found.').show().fadeOut(6000);
} else if (memberid.val() == "") {
$("#videointeractionResults"+Id).html('<img src="images/round_error.png" alt="Error" width="31" height="30" /> Member not found.').show().fadeOut(6000);
} else {
$("#videoFormProcessGif"+Id).show();
$.post(url,{ video: videoid.val(), member: memberid.val(), actyesno: active.val(), creditsNr: credits.val(), vidWipit: video_wipit.val() } , function(data) {
$('#videoprivate_message'+Id).slideUp("fast");
$("#videointeractionResults"+Id).html(data).show().fadeOut(10000);
document.pmForm.active.value='';
document.pmForm.credits.value='';
$("#videoFormProcessGif"+Id).hide();
});
}
}
return false;});});
|
and with this php code I want to call the form:
PHP Code:
$msg_id = uniqid (false);
$saveq = dbquery("SELECT * FROM videos WHERE youtube_id = '".$vidid."'");
$checkvideo = dbrows($saveq);
if($checkvideo == 0):
print "<form action=\"javascript:sendVIDEO();\" name=\"videoForm\" id=\"videoForm".$msg_id."\" method=\"post\">";
print "<input type=\"hidden\" id=\"videoid".$msg_id."\" name=\"videoid\" value=\"".$vidid."\">";
print "<input name=\"mem_id\" id=\"mem_id".$msg_id."\" type=\"hidden\" value=\"".$_SESSION['id']."\" />";
print "<br>";
print "Site active?";
print "<input name=\"active\" id=\"active".$msg_id."\" value=\"1\" type=\"checkbox\" >";
print "<br>";
print "Credits <input type=\"text\" id=\"credits".$msg_id."\" name=\"credits\" value=\"\" size=\"1\" maxlength=\"1\" >";
print "<br>";
print "<input name=\"videoWipit\" id=\"videoWipit".$msg_id."\" type=\"hidden\" value=\"".$thisRandNum."\" />";
print "<input type=\"submit\" value=\"Comment_Submit\" class=\"comment_submit\" id=\"".$msg_id."\" />";
print "<span id=\"videoFormProcessGif".$msg_id."\" style=\"display:none;\"><img src=\"images/loading.gif\" width=\"28\" height=\"10\" alt=\"Loading\" /></span></form>";
I have a lot of forms that's why I need uniqid(), but the whole thing is not working...