Guest User

Untitled

a guest
Jan 16th, 2018
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.86 KB | None | 0 0
  1. $transaction_id = trim($_POST['transaction_id']);//get the Transaction ID from Ajax request..
  2.  
  3. //get the full transaction details as an json from VoguePay
  4. $json = file_get_contents('https://voguepay.com/?v_transaction_id='.$transaction_id.'&type=json');
  5. $transaction=json_decode($json, true);
  6.  
  7. header('Content-Type: application/json');
  8. echo json_encode($transaction);
  9.  
  10. event.preventDefault();
  11. //clear the display section
  12. $("#id-input2").html('');
  13. var data="";
  14. //call the Ajax Request..
  15. $.ajax({
  16. url: "php/fetch_transaction_id.php",
  17. type: "POST",
  18. data: {transaction_id:transaction_id},
  19. dataType: "json",
  20.  
  21. beforeSend: function () {
  22. $("#transaction_id").attr('disabled', true);
  23. $('#searchID').attr('disabled', true);
  24. $('#searchID').val('please wait, sending data...');
  25. },
  26.  
  27. success: function (vp_response) {
  28. $.map(vp_response, function(index, value) {
  29.  
  30. data=index + ' : ' + value;
  31. $("#id-input2").append($("<li>").append(data));
  32. $("#id-input2").css('list-style-type', 'none');
  33. });
  34.  
  35.  
  36. $('#searchID').val('Data Received!');
  37. },
  38.  
  39. error: function () {
  40. $("#id-input2").append('Sorry, There was an error whilst processing your request');
  41. $("#transaction_id").removeAttr('disabled');
  42. $("#transaction_id").val('');
  43. $("#transaction_id").focus();
  44. $('#searchID').removeAttr('disabled');
  45. $('#searchID').val('Query Transaction');
  46. return false;
  47. }
  48.  
  49. });
Add Comment
Please, Sign In to add comment