


Analysis of the problem of error when the post method in Ajax directly returns a number starting with 0
May 22, 2018 pm 04:29 PMThis article mainly introduces the analysis of the error problem of the post method in Ajax directly returning a number starting with 0. Friends in need can refer to it
Today, I found a strange error when sending a simulated verification code on the web page. question. I used the following code to preset the button to send the verification code.
This is the Node.js server
<pre style="font-family: 宋体; font-size: 9pt; background-color: rgb(255, 255, 255);"><pre name="code" class="javascript">$(".reg_code_btn").click(function(e){ $(e.target).parent().children().first().val() $.ajax({ type:"POST", url:"validate/vcode", dataType:"json", data:{ vcode:"code" }, success:function(data){ console.log(data); alert(data); }, error:function(data){ console.log(data); alert("发生错误"); } }); });</pre><br> <br> <pre></pre> <pre></pre> 调试结果如下:</pre>
Starting with 0
I will change the return value of the server If it is of JSON type, the above situation disappears.The reason why adding a random number after the ajax request address prevents browser caching
JS clears the IE browser cache Method
Solve the problem of the browser remembering ajax requests and being able to move forward and backward
The above is the detailed content of Analysis of the problem of error when the post method in Ajax directly returns a number starting with 0. For more information, please follow other related articles on the PHP Chinese website!

Hot Article

Hot tools Tags

Hot Article

Hot Article Tags

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

PHP Tips: Quickly Implement Return to Previous Page Function

How to solve the 403 error encountered by jQuery AJAX request

How to solve jQuery AJAX request 403 error

How to get variables from PHP method using Ajax?

What results does MySQL return after inserting data?

How to solve the problem of jQuery AJAX error 403?

How to implement PHP to jump to the page and carry POST data

PHP code example: How to use POST to pass parameters and implement page jumps
