javascript value passing with asp variable

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    javascript value passing with asp variable

    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
    Code:
        function reload(form){
         var val=form1.drpcolor.options[form1.drpcolor.options.selectedIndex].value;
    self.location='product_detail.asp?intProdID='<%= intProdN%>&<%= intProd2%>drpcolor=' + val ;
        }
        </script>
    Last edited by Frinavale; Jun 18 '09, 08:27 PM. Reason: Please do not douple post your question. It makes it hard to get an answer. Duplicate threads merged.
  • Fary4u
    Contributor
    • Jul 2007
    • 273

    #2
    javascript value passing with asp variable

    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
    Code:
        function reload(form){
         var val=form1.drpcolor.options[form1.drpcolor.options.selectedIndex].value;
    self.location='product_detail.asp?intProdID='<%= intProdN%>&<%= intProd2%>drpcolor=' + val ;
        }
        </script>
    Last edited by Frinavale; Jun 18 '09, 08:28 PM. Reason: Please do not douple post your question. It makes it hard to get an answer. Duplicate threads merged.

    Comment

    • rnd me
      Recognized Expert Contributor
      • Jun 2007
      • 427

      #3
      you can use cookies, the queryString, submitted form inputs, or ajax to talk to asp from javascript.

      Comment

      • jhardman
        Recognized Expert Specialist
        • Jan 2007
        • 3405

        #4
        That looks like it should work. What problems does this give you?

        Jared

        Comment

        • Fary4u
          Contributor
          • Jul 2007
          • 273

          #5
          to use ajax or js event to run asp function ?
          how to call procedure something like that ?

          Code:
          a href="javascript:void()" 
          onclick="javascript:('Add()')"> or
          onClick="javascript: function('Add')"
          onClick="function('Add')"
          onClick="return function('Add')"
          <%
          Function Add()
          ....
          End Function
          %>
          i know it's server side and client side problem but without loading page just to call the function ?

          Comment

          • jhardman
            Recognized Expert Specialist
            • Jan 2007
            • 3405

            #6
            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

            Comment

            Working...