Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ------------------------- Jquery
- function authenticate(username, password) {
- $.ajax ({ type: "POST", url: "/?auth=1", dataType: "json",
- data: '{username:"' + username + '", password:"' + password + '"}',
- success: function (data) {
- console.log(data);
- if(data.result == 1) {
- ------------------------------
- post data (firebug)
- -------------------------------
- JSON
- password "test"
- username "tester"
- Source
- {username:"tester", password:"test"}
- -------------------------------
- Response from post back to jquery (PHP print_r($_REQUEST))
- -------------------------------
- Array
- (
- [auth] => 1 <-- _GET
- )
- {"result":"0","reason":"Incorrect Username\/Password, Please try again."} <-- json return from php script
- -------------------------------
- headers
- ------------------------------
- ResponseHeaders
- Date Mon, 19 Mar 2012 16:13:10 GMT
- Content-Encoding gzip
- X-Powered-By PHP/5.3.3
- Connection close
- Content-Length 120
- Pragma no-cache
- Server Apache/2.2.15 (CentOS)
- Vary Accept-Encoding
- Content-Type text/html; charset=UTF-8
- Cache-Control private, no-cache, no-store, proxy-revalidate, no-transform
- Expires Thu, 19 Nov 1981 08:52:00 GMT
- RequestHeaders
- Content-Type application/x-www-form-urlencoded
- Accept application/json, text/javascript, */*; q=0.01
- X-Requested-With XMLHttpRequest
- ----------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement