Any comment, waiting your help
tep wrote: > > Hello all, > > I am trying to create a widget within .NET that's why using JSONP. But > when i run the code below, i get the error 'Invalid Json Primitive' on > client side before calling web service , how can i handle that ? > > function test2() > { > var params = '{wdgtype:"1"}'; > > $.ajax({ > type: "POST", > url: "service.aspx/GetWidget", > data: params, // Set Method Params > beforeSend: function(xhr) { > xhr.setRequestHeader("Content-length", params.length); > xhr.setRequestHeader("Content-type", > "application/json; charset=utf-8");}, > contentType: "application/json; charset=utf-8", > dataType: "jsonp", > jsonp:"onJsonPLoad", > success: function(msg) { > $("#showyrmwidget").html(msg.d); > }, > error: function(xhr,msg,e){ > alert(xhr.responseText);//Error Callback > } > > }); > } > > function onJsonPLoad(data) > { > alert(data); > } > > [WebMethod()] > public static string GetWidget(string wdgtype) > { > return "test"; > } > > Thanks > > -- View this message in context: http://www.nabble.com/Invalid-Json-Primitive-tp21229536s27240p21248615.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.