By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,569 Members | 1,422 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,569 IT Pros & Developers. It's quick & easy.

javascript value passing with asp variable

Fary4u
100+
P: 273
Hi i need to use javascript variable & asp variable passing the value how can i used the both on the query string ?

here is my code
Expand|Select|Wrap|Line Numbers
  1.     function reload(form){
  2.      var val=form1.drpcolor.options[form1.drpcolor.options.selectedIndex].value;
  3. self.location='product_detail.asp?intProdID='<%= intProdN%>&<%= intProd2%>drpcolor=' + val ;
  4.     }
  5.     </script>
  6.  
Jan 25 '09 #1

✓ answered by jhardman

You can't do it without submitting a form or clicking a link to another page. All server-side code is removed when the page is sent to the browser. The browser can run client-side code (js or ajax), but not server-side code (asp). The only way to get an asp function to run is to ask the server to give you a new page - hence submitting a form or clicking a link that sends you to a new page will work.

Jared

Share this Question
Share on Google+
5 Replies


Fary4u
100+
P: 273
Hi i need to use javascript variable & asp variable passing the value how can i used the both on the query string ?

here is my code
Expand|Select|Wrap|Line Numbers
  1.     function reload(form){
  2.      var val=form1.drpcolor.options[form1.drpcolor.options.selectedIndex].value;
  3. self.location='product_detail.asp?intProdID='<%= intProdN%>&<%= intProd2%>drpcolor=' + val ;
  4.     }
  5.     </script>
  6.  
Jan 25 '09 #2

rnd me
Expert 100+
P: 427
you can use cookies, the queryString, submitted form inputs, or ajax to talk to asp from javascript.
Jan 26 '09 #3

jhardman
Expert 2.5K+
P: 3,405
That looks like it should work. What problems does this give you?

Jared
Jan 26 '09 #4

Fary4u
100+
P: 273
to use ajax or js event to run asp function ?
how to call procedure something like that ?

Expand|Select|Wrap|Line Numbers
  1. a href="javascript:void()" 
  2. onclick="javascript:('Add()')"> or
  3. onClick="javascript: function('Add')"
  4. onClick="function('Add')"
  5. onClick="return function('Add')"
  6. <%
  7. Function Add()
  8. ....
  9. End Function
  10. %>
  11.  
i know it's server side and client side problem but without loading page just to call the function ?
Jun 15 '12 #5

jhardman
Expert 2.5K+
P: 3,405
You can't do it without submitting a form or clicking a link to another page. All server-side code is removed when the page is sent to the browser. The browser can run client-side code (js or ajax), but not server-side code (asp). The only way to get an asp function to run is to ask the server to give you a new page - hence submitting a form or clicking a link that sends you to a new page will work.

Jared
Jun 15 '12 #6

Post your reply

Sign in to post your reply or Sign up for a free account.