I submitted using ajax. Why can I submit data in the first form but cannot submit the data? after clicking submit, there is no response. the console does not report an error. The two forms are exactly the same. why? {Code ...} I submitted using ajax. Why can I submit data in the first form but cannot submit the data? after clicking submit, there is no response. the console does not report an error. The two forms are exactly the same. why?
var oBtn1=document.getElementById('btn1');var oTxt=document.getElementById('textarea');oBtn1.onclick=function(){ oV1=oTxt.value; ajax("{:U('zhuye/zhuye')}",oV1,function(str){ if(str==1){ window.location.reload(); } });}
Reply content:
I submitted using ajax. Why can I submit data in the first form but cannot submit the data? after clicking submit, there is no response. the console does not report an error. The two forms are exactly the same. why?
var oBtn1=document.getElementById('btn1');var oTxt=document.getElementById('textarea');oBtn1.onclick=function(){ oV1=oTxt.value; ajax("{:U('zhuye/zhuye')}",oV1,function(str){ if(str==1){ window.location.reload(); } });}
GetElementById: If you find the first qualified element, it will not continue to be executed. Therefore, if you have two IDs, you will always be able to get the content of the first form.
Isn't your textarea id repeated?
This is an obvious error. the element IDs in HTML should be unique.
ID is unique and cannot be repeated.
Id is unique on the same page