How to pass JavaScript data to PHP

Source: Internet
Author: User
How can I transmit JavaScript data to PHP? The status quo is as follows: after using Sina API to implement login, JS callback functions will be called: function & nbsp; login (o) & nbsp ;{}& nbsp; the input parameter o is the JSON of the user information. now I want to display the data at the front end, but PHP is executed in the background. & how can I transmit the data in JavaScript to PHP?
The status quo is as follows:
After using Sina API to implement login, the callback function of JS will be called:

Function login (o ){

}
 


The input parameter o is the JSON of the user information. now I want to retrieve this data and display it on the front end,
However, PHP is executed in the background, so I want to use window. location. href to jump to another PHP page,
When passing parameters at the same time, the question is how to pass this o to the PHP page?

I don't know if it is feasible to use form? Is there a common method recommendation?
------ Solution --------------------
Refer:
Http://stackoverflow.com/questions/2367979/pass-post-data-with-window-location-href
POST is not allowed.
Only by setting parameters to window. location. href URL is equivalent to GET, but GET has a limit on the number of words, which makes the URL ugly.
Of course, there is another way to use cookies. However, cookies have many legal restrictions in many countries.
------ Solution --------------------
Reference:
Why can't I post? I think POST is pretty good.

I can't explain it clearly, so I referenced stackoverflow's Q & A, which is a global Q & A forum with experts like cloud.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.