Ajax With Form Serialize
html form
<form id="form_id"></form>
javascript Code
<script>
var data = $('#form_id').serialize();
$.ajax({
url: 'https://www.postsparrow.com/get_data',
type: 'POST',
dataType: 'JSON',
data: data,
success: function (data)
{
if(data.url)
{
window.location.href = url;
}
else
{
window.location.reload();
}
}
});
</script>
0 Comments