I am trying to send my form data to php method below is the code:
<script>
$(document).ready(function(){
$("#submit").click(function(event){
var data = $.param($("#form").serializeArray());
event.preventDefault();
$.ajax({
type: "POST",
url: "customers.php",
data: data,
});
request.done(function() {
$( "#message" ).html("Record entered");
});
});
});
</script>
So the above code is making a string of name and value.
I would like to use that string in my php method but was unable to do that.
<?php
if(isset($_POST['customername'])){
$arg = $_POST['customername'];
$customer->Add_Customer($arg);
}
?>
as you can see my method requires an array basically a numeric array
like : john,23,england,76001
Can anyone please guide me how can i do that i dont wanna send it via GET.
Thanks
$_POST.