c# - unexpected token < when calling asp.net remote webservice .asmx using ajax() and jsonp -


i have basic - testing - asp.net web service (2.0 , iis 6.0) written in vb running on remote server

web service

 <webservice(namespace:="cms_checklistsystemwebservice")> _  <webservicebinding(conformsto:=wsiprofiles.basicprofile1_1)> _  <global.microsoft.visualbasic.compilerservices.designergenerated()> _  <system.web.script.services.scriptservice()> _  public class cms_checklistsystemwebservice     inherits system.web.services.webservice     <webmethod()> _     public function helloworld() string         return "hello world"     end function 

config.

i had add these following lines webservice config in order able run webservice in browser

<system.web>     <webservices>         <protocols>             <add name="httpget"/>             <add name="httppost"/>         </protocols>     </webservices> </system.web> 

**web service outcome ** enter image description here

i trying call web service php page using ajax jquery running xampp v3.1

jquery

  $.ajax({         type: "get",         url: "http://192.168.25.11/link web service",             data: "",             datatype: "jsonp",             contenttype: "application/jsonp; charset=utf-8",             success: function(data) {                 console.log(data);             }         }); 

error

following how console looks after calling ajax() function enter image description here

fyi if click on link in second line link webservice , run in first image

notice

if use same webservice same project - domain - can ajax() call , type='json' , works no errors

question

  • what i'm doing wrong ?
  • do need make webservice return json object instead of xml if yes how

i think problem is, specifying content type json in ajax call. but, web service returning xml.

so, either can specify content type xml in ajax call , process xml (i not sure whether possible or not), or can configure web service return json.

refer question (how return json 2.0 asmx web service) configure web service return json.


Comments

Popular posts from this blog

c# - Operator '==' incompatible with operand types 'Guid' and 'Guid' using DynamicExpression.ParseLambda<T, bool> -