asp.net - passing multiple values from multiple textboxes in jquery -
Below is a jquery script that takes an input from textBox1 and passes it to a web method, giving the person's name And displays it in Textbox 2. The web method has only one parameter, the user initials.
& lt; Script type = "text / javascript" & gt; $ ('# Textbox1') Live ('keydown', function (e) {var keycode = e.kcode || e.which; if (keycode == 9) {e.preventDefault (); $ .ajax ({type: "post", url: "Default.aspx / GetName", Content Type: "Application / Jason; Charset = UTF-8", Data Type: "Jason", Data: '{"value1": "' + $ ('# Textbox1'). () + '"}', Success: function (data) {$ ('# textbox2'). Val (data.d);}});}}); & Lt; / Script & gt;
I want to be able to pass two values of two text boxes for a web method, for which two parameters are required, how do I modify the jquery code above to complete it? Can i do
You add parameters for the data object, the way an object should be:
Data: {value1: $ ('# textbox1'). Val (), Value 2: $ ('# textbox2'). Val ()},
Comments
Post a Comment