Advertisement
Guest User

Untitled

a guest
Jul 9th, 2018
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. ------------------------- Jquery
  2. function authenticate(username, password) {
  3.  
  4. $.ajax ({ type: "POST", url: "/?auth=1", dataType: "json",
  5. data: '{username:"' + username + '", password:"' + password + '"}',
  6. success: function (data) {
  7. console.log(data);
  8. if(data.result == 1) {
  9. ------------------------------
  10.  
  11.  
  12. post data (firebug)
  13. -------------------------------
  14. JSON
  15. password "test"
  16. username "tester"
  17.  
  18. Source
  19. {username:"tester", password:"test"}
  20. -------------------------------
  21.  
  22. Response from post back to jquery (PHP print_r($_REQUEST))
  23. -------------------------------
  24. Array
  25. (
  26. [auth] => 1 <-- _GET
  27. )
  28.  
  29. {"result":"0","reason":"Incorrect Username\/Password, Please try again."} <-- json return from php script
  30. -------------------------------
  31.  
  32.  
  33. headers
  34. ------------------------------
  35. ResponseHeaders
  36. Date Mon, 19 Mar 2012 16:13:10 GMT
  37. Content-Encoding gzip
  38. X-Powered-By PHP/5.3.3
  39. Connection close
  40. Content-Length 120
  41. Pragma no-cache
  42. Server Apache/2.2.15 (CentOS)
  43. Vary Accept-Encoding
  44. Content-Type text/html; charset=UTF-8
  45. Cache-Control private, no-cache, no-store, proxy-revalidate, no-transform
  46. Expires Thu, 19 Nov 1981 08:52:00 GMT
  47. RequestHeaders
  48. Content-Type application/x-www-form-urlencoded
  49. Accept application/json, text/javascript, */*; q=0.01
  50. X-Requested-With XMLHttpRequest
  51. ----------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement