Hi,I am new to jquery n using below code for submitting data in database.
Its working fine for small data but not working for large data.
Need suggestions
Php code:
<?php
include('db.php');
if($_POST)
{
$name=$_POST['name'];
$desc=$_POST['desc'];
$price=$_POST['price1'];
//$type=$_POST['type'];
mysql_query("INSERT INTO `pgdetail` (`name`, `desc`, `price`) VALUES ('$name', '$desc', '$price')");
}
?>
$(function() {
$(".submit").click(function() {
var name = $("#name").val();
var desc = $("#desc").val();
var price1 = $("#price1").val();
var dataString = 'name='+ name + '&desc=' + desc + '&price1=' + price1;
//document.write(name);
if(name=='' || desc=='' || price1=='' )
{
$('.success').fadeOut(200).hide();
$('.error').fadeOut(200).show();
}
else
{
//alert('hi');
$.ajax({
type:"POST",
url:"addpg.php",
data:dataString,
success: function(){
$('.success').fadeIn(200).show();
$('.error').fadeOut(200).hide();
$('#name').val('');
$('#desc').val('');
$('#price').val('');
}
});
}
return false;
});
});
</script>