JQuery Code ::
$( document). ready (function () {
//get-pnr-status is the id of the button or link.
$('#pnrstatus' ).click (function(){
$. ajax ({
//1234567890 is the pnr number. replace with the variable.
url: 'http://indianrailapi.com/api/pnrstatus/apikey/abc...xyz/pnr/1234567890/',
method: 'GET',
crossDomain: true,
dataType: 'json',
success: function(data){
//You will need json2js for this alert.
alert(JSON.stringify(data));
//result is the id of div where this response json will be displayed.
$('#result').html(JSON.stringify(data));
},
error: function(data){
alert('ERROR');
}
});
});
});
Contributed By : Nimesh Bansal