Home > Article > Web Front-end > Things to note when transferring values between pages
In JavaScript, you need to pay attention to the value transfer between pages.
For example, when we pass a number to the next page through the URL, it may be a string after being parsed on the next page. This will cause a phenomenon. When debugging, I found that the value I wanted to pass was indeed passed, but an error was reported on the page and the effect was not achieved. At this time, we need to convert this value. (For example: data="1234"; parseInt(data);)
jQuery ajax
In development, you have to deal with the background in many cases. Generally, when we get the value returned to us by the background, we need to pass some values to the background. These will be written in the interface document, we need to read them clearly. Pay attention to the type of value passed. The interface document will state the data type you want to pass and the data type it passes to you. If you see these clearly, you will save a lot of debugging.
In order to apply the data passed from the background, we can perform some conversions on the data type. For example:
var obj = $.parseJSON('{"name": "Sage"}'); //jasn to object
alert(obj.name === " Sage");
When forming data into an array, you can use push
The above is the detailed content of Things to note when transferring values between pages. For more information, please follow other related articles on the PHP Chinese website!