0

Hi, I want to send three text box values to server using jquery ajax. problem is that, i dont know the exact syntax to send three data. When i try sending one data(also change no.of parameters to one at server side method), its going good but when i try to send three text box values, its giving jquery error:"Internal server error". I think I am not sending data in correct way. please somebody tell me how to do that. Example below contains only two sending data, because i was trying to send 2 data first.

Below is the code:

function testCAll() { 
$.ajax({ 
    type: "POST", 
    url: "dbTest1.aspx/SendMessage", 
    data: "{'name': '" + $('#Eid').val() + "', 'phone': '" + $('#phn').val() + "'}", 
    //data: "{'phone': '" + $('#CustomerPhone').val() + "'}", 
    //data: "{'color': '" + $('#ColorId').val() + "'}", 
    contentType: "application/json; charset=utf-8", 
    dataType: "json", 
    success: function(result) { 
        resultData = eval("(" + result.d + ")"); 
        $("#rawResponse").html(concatObject(resultData)); 
    }, 
    error: function(result) { 
        alert("jQuery Error:" + result.statusText); 
    } 
});

Edited by amby: n/a

2
Contributors
2
Replies
5
Views
7 Years
Discussion Span
Last Post by amby
0

When passing data using ajax you only pass one data element and use a json object to pass more than one value.

data: {
    data1:{'name':$('#Eid').val(),'phone':$('#phn').val()},
    data2:{'phone':$('#CustomerPhone').val()},
    data3:{'color':$('#ColorId').val()}
}
0

thanks, problem solved using below string:
data: "{name: '" + $('#Eid').val() + "', phone: '" + $('#phn').val() + "'}",

i have found out that problem is on my server side.

Thanks.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.