JSON, JSON, JSON! why is it always JSON? (Jan Brady...you crazy kid, you)
I was searching all over the place for how to submit parametrized data to an .asmx Web Service using XML. (Passing a DataSet between WebApp and WebService anyone?) Silly me, I thought someone would have done something I wanted to do. Regardless, had to figure it out. So this is the simple way to do it:
try
{
$.ajax({
type: "POST"
, url: "http://localhost:50372/WidgetService.asmx/SaveWidgetPreferences"
, data: { UserWidgetData: UserInformation }
, error: function(XMLHttpRequest, textStatus, errorThrown)
{
//which one is the unterminated string constant?
debugger;
}
, success: function(results)
{
debugger;
alert($(results).length);
}
});
}
catch (err)
{
alert(err);
debugger;
}So if you are hitting a Web Service from 1.1 or 2.0 land that hasn't converted over to using JSON yet, there ya go.
J.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment