Showing posts with label Simple jquery ajax example tutorial. Show all posts
Showing posts with label Simple jquery ajax example tutorial. Show all posts

Friday 5 August 2016

Simple jquery ajax example with GET method


Simple jquery ajax example with GET method

<div id="result"></div>
<button type="button" onclick="dataProcess();" class="btn btn-block btn-express-buynow">Buy Now</button>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script type="text/javascript">
jQuery(document).ready(function()
function dataProcess()
 {
jQuery.ajax({
type:"GET", // You can use post method here also
url:"http://www.your-site.com?para=val", // Give your own url
success:function(data){
jQuery('#result').html(data);
window.location.href = "http://www.your-site.com/checkout/onepage/"; // if you want redirect another page after success data
}
});
 }
});

</script>