Passing more than one parameter from asp page to javascript

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • earias
    New Member
    • Nov 2006
    • 1

    Passing more than one parameter from asp page to javascript

    Hello

    I'm totally new on AJAX programming. I'm trying to add new records to a database from a web form placed in asp.net page. When i click on submit button i need to pass 3 parameters to a .js file. Fields are: CustomerKey, FirstName and LastName.

    I can add a new record if i pass just the CustomerKey value. I'm passing that using this: onclick="addcus tomer(txt_Custo merkey.value)"

    So, what i need is pass more than one parameter. How can i pass FirstName and LastName at the same time as CustomerKey??

    Regards
    E!
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    Change addcustomer() to accept three arguments, e.g. function addcustomer(cus tomerkey, firstname, lastname) { ...

    Now pass the other two values separated by commas: onclick="addcus tomer(txt_Custo merKey.value, txt_FirstName.v alue, ...)"

    When passing to the ASP page, use & to separate the parameters.

    Comment

    Working...