php - Posting JSON string to login to a website using JavaScript -


i trying write javascript can me post json data website's json_server.php page login successfully.

an example of json data follows:

{     "method":"validateuseraccountwithusernameandpassword",     "id":100000,     "params":[         "testname",         "password",         "empid"     ] } 

there 2 scenarios:

1) tired method mentioned in post using javascript/ajax, got blank page. tested running script notepad++ firefox browser.

2) used above json on chrome extension called postman , worked fine, passing json string returned 200 ok, not sure how when through, see lots of tokens been passed.

i need working javascript can post json string me login in scenario 1 ?

isn't blank page looking ?

i mean what's difference between , simple 200 ok response ?

what see here :

  • you post json
  • the php page goes through it, credentials corrects
  • the php returns blank response 200 ok status tell you correctly identified (maybe creates cookie @ same time token, maybe not)

do have doc json_server.php supposed answer ?


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -