Home > Article > Web Front-end > Detailed explanation of the error reported when the post method returns in Ajax
This time I will bring you a detailed explanation of the error reported when the post method returns in Ajax. What are the precautions when dealing with the error reported when the post method returns in Ajax. The following is a practical case, let's take a look.
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("发生错误"); } }); });
object object all have the same commonality:
starts with 0
I Change the server's return value to JSON type and the above situation will disappear. # I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website! Recommended reading:How to communicate data between C and View
What are the front-end and back-end types? ajax interaction method
The above is the detailed content of Detailed explanation of the error reported when the post method returns in Ajax. For more information, please follow other related articles on the PHP Chinese website!