I've create a form using jQuery
and I want to submit it into my SQL SERVER
Database by AJAX
. but It won't submit, I don't know where the problems comes. I create this site with ASP.
Here is the javascript
to submit:
$("#reg_tr_new").click(function(){
$("#refresh_tr").submit();
});
$("#refresh_tr").validate({
debug: false,
rules: {
deskripsi: "required"
},
messages: {
deskripsi: {
required: 'Deskripsi harus diisi'
}
},
success: "valid",
submitHandler: function(form) {
$("#right-container").hide();
$("#add_no").show();
.post('trx_menu/queries/svTR_.asp', $("#refresh_tr").serialize(), function(data) {
$('#refresh_tr_show').html(data);
});
}
});
Here is the code in trx_menu/queries/svTR_.asp
:
<%
noTrx=request.form("noTrx")
deskripsi=request.form("deskripsi")
from=request.form("from")
tos=request.form("tos")
user_input=Session("ss_ckduser")
BankTrx=request.form("BankTrx")
Dim tgl_inpt
tgl_inpt=Now
strsql="select count(*)+1 as idtrbaru from "& dbweb &".dbo.trmitrareghd"
set qdata = conn.execute(strsql)
idbaru = qdata("idtrbaru")
strsql="insert into "& dbweb &".dbo.trmitrareghd values('"& idbaru &"','"& noTrx &"','"&BankTrx&"','"& deskripsi &"','"&date()&"','"&date()&"','0','"& user_input &"','"& tgl_inpt &"')"
set qdata = conn.execute(strsql)
'response.write strsql
%>
You have the validation plugin debug
option set to true which blocks form submittal while you ...debug!
You are also missing a $
before post
.post('trx_menu/queries/svTR_.asp'......
Should be:
$.post('trx_menu/queries/svTR_.asp'......
Use a browser console to check script and syntax errors as well as to inspect the request itself.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.