ITsolutionWizard
asked on
jquery/ajax to code behind
I have below object called resultObj from jquery,
how can I pass to code behind c#?
$.ajax({
cache: false,
type: "GET",
async: false,
dataType: "json",
contentType: 'text/plain',
url: GetDealerList + encodeURIComponent("(06234 ,'1111,asd fasdfasd,a sdfasfasdf ')"),
success: function (data) {
$('#data').html(data);
alert(data);
if (data == null)
return;
resultObj = jQuery.parseJSON(data);
if (resultObj.Status != 'Failed') {
$('#json').html(createDeal er(resultO bj.Data));
}
},
error: function (xhr) {
$('#data').html(xhr.respon seText);
//alert(xhr.responseText);
}
});
how can I pass to code behind c#?
$.ajax({
cache: false,
type: "GET",
async: false,
dataType: "json",
contentType: 'text/plain',
url: GetDealerList + encodeURIComponent("(06234
success: function (data) {
$('#data').html(data);
alert(data);
if (data == null)
return;
resultObj = jQuery.parseJSON(data);
if (resultObj.Status != 'Failed') {
$('#json').html(createDeal
}
},
error: function (xhr) {
$('#data').html(xhr.respon
//alert(xhr.responseText);
}
});
As described here: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/stringify use JSON.stringify to covert the js object to JSON format. Then include that in your ajax request.
ASKER
I need some sample codes to support what you mentioned....Thanks
url: GetDealerList + encodeURIComponent(JSON.st ringify(re sultObj)),
ASKER
inside of code behind. how can i capture it?
The querystring will be sent and made available to your webmethod. I'm not familiar with .net but usually done with the Request class
ASKER
Not sure which property should be used from request.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.