views:

16

answers:

1

I have the ajax call to webservice jsonwebservice.asmx ,my datatype is xml, i have problem with passing data to webservice is thier any syntax problem

$.ajax({ type: "POST", async: false, url: "/blkseek2/JsonWebService.asmx/GetList", datatype:"xml", data: "keyword1="+keyword1+ "streetname="+address1+ "lat="+lat+ "lng="+lng+ "radius="+radius ,

             failure: function(XMLHttpRequest, textStatus, errorThrown) 
                     { ajaxError(XMLHttpRequest,textStatus, errorThrown); },
                success: function(xml) 
                 { ajaxFinish(xml); }



            });
            });
    });
+1  A: 

Try to make the data into xml.

$.ajax({ type: "POST", async: false, url: "/blkseek2/JsonWebService.asmx/GetList", datatype:"xml", data: "<?xml version='1.0'?><keyword1>"+keyword1+ "</keyword1><streetname>"+address1+ "</streetname><lat>"+lat+"</lat><lng>"+lng+ "</lng><radius>"+radius+"</radius>" ,
Torbjörn Hansson
Thanks for the reply,can write webmethod as shown below to catch the xml parameters passed from client side ajax call[WebMethod] [ScriptMethod(ResponseFormat = ResponseFormat.Xml)] public XmlDocument GetList(string keyword1, string streetname, string lat, string lng, string radius) { XmlDocument xmldoc= CreateXML( keyword1,streetname,lat,lng,radius); // xmlDoc.Save(@"C:\Documents and Settings\Vijay.EKO-03\Desktop\blkseek2\Block3.xml"); return xmldoc; }
mahesh