jQuery form with Ajax call, passing data
HTML
<form action="">
<input type="text" name="OrderID"/>
<input type="submit" name="go" value="Go" />
</form>
JavaScript
jQuery(document).ready(function ($) {
$('input[type=submit]').click(function(){
var data = {apiKey: 'bac6ab80-5d78-4d89-ab22-16e8b921c768',
where: JSON.stringify($('input[name=OrderID]').val())
/// $('input[name=OrderID]').val()
}
$.ajax({
url: 'https://api.appery.io/rest/1/apiexpress/api/Website/Tracking',
data:data,
type:'GET',
beforeSend: function(xhr, settings){
console.log(settings.url);
alert(settings.url);
},
success: function(res) {
///////
alert(response[0].OrderID);
document.write("<br /><strong>OrderID:</strong> " + response[0].OrderID + "<br /> <strong>Status:</strong> " + response[0].OrderStatus);
///////
}
});
return false;
})
});