Passing queries with javascript?

Results 1 to 2 of 2

Thread: Passing queries with javascript?

  1. #1
    Join Date
    Dec 1969

    Default Passing queries with javascript?

    Hello.. How do I pass a query with javascript? For instance, if I had:<BR><BR>function refresh()<BR>{<BR>document.resp.method = "post";<BR>document.resp.action = "resp1.asp";<BR>document.resp.submit();<BR>}<BR><B R>how do I send queries with resp1.asp?<BR><BR>thanks,<BR>dep<BR>

  2. #2
    Join Date
    Dec 1969

    Default Two ways...

    (1) Have a hidden field in the form. Use JS code to put a value into that field:<BR><BR>function refresh()<BR>{<BR>document.resp.theHiddenField.val ue = somethingOrOther;<BR>document.resp.method = "post";<BR>document.resp.action = "resp1.asp";<BR>document.resp.submit();<BR>}<BR><B R>(2) Just tack it onto the action<BR><BR>function refresh()<BR>{<BR>document.resp.method = "post";<BR>document.resp.action = "resp1.asp?someName=someValue";<BR>document.resp.s ubmit();<BR>}<BR><BR>If the value might contain non-alphanumeric characters, use escape (very similar to Server.URLEncode):<BR><BR>function refresh()<BR>{<BR>document.resp.method = "post";<BR>document.resp.action = "resp1.asp?something=" + escape(whatever);<BR>document.resp.submit();<BR>}< BR><BR>Personally, I like way (1) a lot better. Your mileage may vary.<BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts