The function ajaxPost (id) {
$. Ajax ({
Url: 'savewancheng. Asp,
data: {id: id},
Type: "POST",
DataType: 'text',
Error: function (XHR) {alert (' error \ n + XHR. The responseText)}
})
}
</script>
this paragraph: how can the submission id and the checkbox two variables at the same time?
<% if the rs (" wancheng ")=0 then % & gt;
<% % the else & gt;
<% end if % & gt;
Savewancheng. Asp page
<%
Id=request (" id ")
Wancheng=request (" wancheng ")
The set rs2=server. CreateObject (" adodb. You ")
Rs2. Open the "select * from chuhuodan where _identify='" & amp; Id&" '", conn2, 1, 3
If wancheng=1 then
Rs2 (" wancheng ")=1
The else rs2 (" wancheng ")=0
End the if
Rs2. Update
Rs2. Movenext
Rs2. Close
The set rs2=nothing
% & gt;
CodePudding user response:
1. Directly inside the onclick parameters more2. Inside the ajaxPost checkbox for value added to the data: {id: the id, the checkbox: checkbox}
CodePudding user response:
<script>The function ajaxPost ( id, the checkbox {
)$. Ajax ({
Url: 'savewancheng. Asp,
Data: { id: the id, the checkbox: checkbox },
Type: "POST",
DataType: 'text',
Error: function (XHR) {alert (' error \ n + XHR. The responseText)}
})
}
</script>
<% if the rs (" wancheng ")=0 then % & gt;
<% % the else & gt;
<% end if % & gt;
This not line?
CodePudding user response:
Not line? Are now code didn't necessary, the form and the checkbox to the API is to write the value of the dead, will not changes according to the checkbox, onclick click the checkbox is triggered,CodePudding user response:
<% if the rs (" wancheng ")=0 then % & gt;<% % the else & gt;
<% end if % & gt;
Ok, thank you! Logic is inside out,