javascript - using Ajax to send information to classic ASP -


i'm new please bare me.

i have reset button on html table. when clicked, gets information related row, particularly 'record id' , 'active'. i'm trying take record id number , send asp page called resetinbound.asp

this first time using ajax i'm not sure if i'm doing correct here code on click:

 $(function(){ $('button').on('click', function(){     var tr = $(this).closest('tr');     var recid = tr.find('.recid').text();     var active = tr.find('.active').text();     alert('id: '+recid+', active: ' + active);  $.ajax({             type: "post",              url: "resetinbound.asp",              data: recid,              success: function() {                  alert("i after sending data sucessfully server.");}              });       // ajax call ends      }); }); 

the asp file code:

dim recid recid = request.querystring("recid") 

i tried request.form , request.binaryread none of them worked. seems code doesn't reach asp page @ all. doing wrong?

the data member of ajax param needs object specifies name , value of each parameter. you'll need change this:

$.ajax({     type: "post",     url: "resetinbound.asp",     data: recid,     ... }); 

to:

$.ajax({     type: "post",     url: "resetinbound.asp",     data: { "recid": recid },     ... }); 

and should receive named parameter in asp page:

strid = request.form("recid") 

if want make things easier debug, however, use get instead of post , pass values via querystring/url:

$.ajax({     type: "get",     url: "resetinbound.asp?recid=" + recid,     ... }); 

then receive param via request.querystring():

strid = request.querystring("recid") 

Comments

Popular posts from this blog

html - Firefox flex bug applied to buttons? -

html - Missing border-right in select on Firefox -

c# - two queries in same method -