-1

I am trying to write a javascript that can help me post JSON data to the website's json_server.php page to login successfully.

An example of the JSON data will be as follows:

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

There are two scenarios:

1) I tired the method mentioned in the post using javascript/ajax, but all I got was a blank page. This was tested by running the script from notepad++ to firefox browser.

2) I used the above JSON on a chrome extension called POSTMAN and it worked fine, passing the JSON string which returned with 200 OK, but not sure how it when through, as I see lots of tokens been passed.

I need to get a working javascript that can post JSON string successfully that will help me login successfully like in scenario 1 ?

Community
  • 1
  • 1
Ajov Crowe
  • 459
  • 3
  • 8
  • 17

1 Answers1

1

Isn't a blank page what you are looking for ?

I mean what's the difference between it and a simple 200 OK response ?

What I see here is :

  • You POST your JSON
  • the php page goes through it, the credentials are corrects
  • the php returns a blank response with 200 OK status to tell you that you are correctly identified (maybe it creates a cookie at the same time with a token, maybe not)

Do you have any doc about what json_server.php is supposed to answer ?

Paul L
  • 97
  • 9
  • Please do not ask questions in an answer. – Jay Blanchard Aug 18 '14 at 13:01
  • Yhea, I'd like to right comments instead, but I don't have 50 rep' points yet. Plus rhetorical questions aren't really questions. – Paul L Aug 18 '14 at 13:03
  • Didn't say I couldn't, yet the only way to earn points at my level are by having answers upvoted so ... – Paul L Aug 18 '14 at 13:05
  • Then post answers instead of questions :) Or go edit some posts in the review queue. http://meta.stackoverflow.com/questions/252133/50-reputation-points-to-make-comments and http://meta.stackexchange.com/questions/17204/six-simple-tips-to-get-stack-overflow-reputation-fast You'll probably find that this 'answer' will get deleted at some point. – Jay Blanchard Aug 18 '14 at 13:07
  • Again, how a rhetorical question isn't an answer ? Plus I'm not authorized to edit anything ... – Paul L Aug 18 '14 at 13:10
  • Apologies, if my question was not clear. I have made some edits to help explain the scenario in a better manner. – Ajov Crowe Aug 18 '14 at 13:15
  • So what shall I do if I want to help Ajov Crowe here but I don't have those 50 rep' points required ? – Paul L Aug 18 '14 at 13:33