Jump to content

Ajax not submiting


sniperscope

Recommended Posts

Hi

I have some Ajax code using two different page. One page is working fine(this page send only one parameter to actual php script)

But same code is not sending value.

Here is register.php (which is not working) Is that possible to sending large data cause this?

 

Regards

 

<script type="text/javascript" src="js/wysiwyg/jquery.js"></script>
<script type="text/javascript" src="js/jquery-1.6.2.js"></script>
<script type="text/javascript">

$(function(){
  $(document).ready(function(){$('#load').hide();});
  $(".sendme").click(function(){
	// validate and process form
	// first hide any error messages
    $('.error').hide();

//hide the form
//$('#signupForm').fadeOut();

//show the loading bar
$('.loader').append($('.bar'));
$('.bar').css({display:'block'});

	var name = $("input#GN").val();
	if(name == "")
	{
		$("input#GN").focus();
		return false;
	}
	var dl = 0;
	if($("#dl:checked").length == 1)
	{
		dl = 1;
	}
	var radio_bx = "";
	if($('input[name=vp]:radio:checked').length > 0 ){radio_bx = $('input[name=vp]:radio:checked').val();}

	var age = $("input#Age").val();
	if(age < 15)
	{
		alert("Must be atleast 15 years old");
		$("input#Age").focus();
		return false;
	}

	var ht = $("input#ht").val();
	var bt = $("input#bt").val();
	var cp = $("#cp").val();
	var wt = $("input#wt").val();
	var hi = $("input#hi").val();
	var pt = $("#pt").val();
	var sk = $("input#sk").val();
	var tai = $("input#tai").val();
	var OW = $("input#OW").val();
	var pl = $("input#pl").val();
	var mn = $("textarea#mn").val();
	var gs = $("textarea#gs").val();
	var i1 = $("#i1").val();
	var i2 = $("#i2").val();
	var o1 = 0;
	var o2 = 0;
	var o3 = 0;
	var o4 = 0;
	var o5 = 0;
	var o6 = 0;
	var o7 = 0;
	var o8 = 0;
	var o9 = 0;
	var o10 = 0;
	var o11 = 0;
	var o12 = 0;
	var o13 = 0;
	if($("#o01:checked").length == 1){ o1 = 1;}
	if($("#o02:checked").length == 1){ o2 = 1;}
	if($("#o03:checked").length == 1){ o3 = 1;}
	if($("#o04:checked").length == 1){ o4 = 1;}
	if($("#o05:checked").length == 1){ o5 = 1;}
	if($("#o06:checked").length == 1){ o6 = 1;}
	if($("#o07:checked").length == 1){ o7 = 1;}
	if($("#o08:checked").length == 1){ o8 = 1;}
	if($("#o09:checked").length == 1){ o9 = 1;}
	if($("#o10:checked").length == 1){ o10 = 1;}
	if($("#o11:checked").length == 1){ o11 = 1;}
	if($("#o12:checked").length == 1){ o12 = 1;}
	if($("#o13:checked").length == 1){ o13 = 1;}

	var op = o1 +'-'+ o2 +'-'+ o3 +'-'+ o4 +'-'+ o5 +'-'+ o6 +'-'+ o7 +'-'+ o8 +'-'+ o9 +'-'+ o10 +'-'+ o11 +'-'+ o12 +'-'+ o13;

	var bl = $("input#blog").val();

	var dataString = 'GN='+ name + '&dl=' + dl + '&vp=' + radio_bx + '&age=' + age + '&h=' + ht + '&b=' + bt + '&c=' + cp + '&w=' + wt + '&hi=' + hi + '&pt=' + pt + '&sk=' + sk + '&tai=' + tai + '&OW=' + OW + '&pl=' + pl + '&mn=' + mn + '&gs=' + gs + '&i1=' + i1 + '&i2=' + i2 + '&op=' + op + '&bl=' + bl;
	alert(dataString);

	$.ajax({
		type: "POST",
		url: "sql/add.php",
		data: dataString,
		success: function(){
			$('#signupForm').html("<div id='message'></div>");
			$('#message').html("<h2>it is done!</h2>")
			.append("<p>you will be redirect</p>")
			.hide()
			.fadeIn(1500, function(){$('#message').append("<img id='checkmark' src='images/check.png' />");});
		}
	});
    return false;
});
});



function KDi($AD)
{
	var i = document.getElementById($AD);
	i.readOnly = true;
	return false;
}
function KDa($AD)
{
	var i = document.getElementById($AD);
	i.readOnly = false;
}
</script>

<form method="post" action="" id="signupForm">
<input type="text" id="GNe" name="GN" style="width:80px;" onblur="KDi('GalName');" onfocus="KDa('GalName');" />  
<input type="checkbox" name="dl" id="dl" />  
<input type="radio" name="vp" value="0" id="vp" checked="checked" />--<input type="radio" name="vp" id="vp" value="1" />1
<input type="text" name="Age" id="Age" style="width:30px;" onblur="KDi('Age');" onfocus="KDa('Age');" />
<input type="text" name="ht" id="ht" onblur="KDi('ht');" onfocus="KDa('ht');" size="3" />
<input type="text" name="bt" id="bt" size="3" onblur="KDi('bt');" onfocus="KDa('bt');" />
<select name="cp" id="cp"><option value="A" selected="selected">A</option><option value="B">B</option><option value="C">C</option><option value="D">D</option><option value="E">E</option>
<option value="F">F</option><option value="G">G</option><option value="H">H</option><option value="I">I</option><option value="J">J</option></select>
<input type="text" name="wt" id="wt" size="3" onblur="KDi('wt');" onfocus="KDa('wt');" />
<input type="text" name="hi" id="hi" size="3" onblur="KDi('hi');" onfocus="KDa('hi');" />
<select name="pt" id="pt"><option value="" selected="selected">--</option><option value="1">1</option></select>
<input type="text" name="sk"  id="sk" onblur="KDi('sk');" onfocus="KDa('sk');" size="50" />
<input type="text" name="tai"  id="tai" onblur="KDi('tai');" onfocus="KDa('tai');" size="50" />
<input type="text" name="OW" id="OW" onblur="KDi('OW');" onfocus="KDa('OW');" size="50" maxlength="13" />
<input type="text" name="pl" id="pl" onblur="KDi('pl');" onfocus="KDa('pl');" size="50" />
<textarea name="mn" id="mn" cols="44" rows="7" onblur="KDi('mn');" onfocus="KDa('mn');" ></textarea>
<textarea name="gs" id="gs" cols="44" rows="7" onblur="KDi('gs');" onfocus="KDa('gs');" ></textarea>
<select name="i1" id="i1"><option value="0" selected="selected">--</option><option value="1">1</option><option value="2">1</option></select>
<select name="i2" id="i2"><option value="0" selected="selected">--</option><option value="1">1</option><option value="2">2</option></select>
<input name="o01" id="o01" type="checkbox">
<input name="o02" id="o02" type="checkbox">
<input name="o03" id="o03" type="checkbox">
<input name="o04" id="o04" type="checkbox">
<input name="o05" id="o05" type="checkbox">
<input name="o06" id="o06" type="checkbox">
<input name="o07" id="o07" type="checkbox">
<input name="o08" id="o08" type="checkbox">
<input name="o09" id="o09" type="checkbox">
<input name="o10" id="o10" type="checkbox">
<input name="o11" id="o11" type="checkbox">
<input name="o12" id="o12" type="checkbox">
<input name="o13" id="o13" type="checkbox">
<input type="text" name="bl" id="bl" size="70" onblur="KDi('bl');" onfocus="KDa('bl');" />
<input type="submit" id="sendme" class="button" value="sendme"> <input type="reset" class="button_grey" value="reset">
</form>

 

And here is how i check whether if it working or not (add.php)

	$fp = fopen("t.txt", 'a');
fwrite($fp, "This is test");
fclose($fp);

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.