Right from the docs
http://docs.jquery.com/Ajax/jQuery.ajax#options

"Object must be Key/Value pairs"

something that

data: "pText=some text"

is not  (it's a string)

so with that pointed out, try

$.ajax({
          url: "Publication.asmx/GetPublication",
          data: { pText: "some text" },
          type: "POST",
          contentType: "application/json; charset=utf-8",
          dataType: "json",

});


On Jan 29, 10:58 am, graphicsxp <graphic...@googlemail.com> wrote:
> Hi,
>
> I'm trying to send a string to my webservice. The method I call
> expects a string parameter and returns a string of JSON data.
>
> I've tried this way :
>
>  $.ajax({
>           url: "Publication.asmx/GetPublication",
>           data: "pText=some text",
>           type: "POST",
>           contentType: "application/json; charset=utf-8",
>           dataType: "json",
>
> });
>
> in which case I get the following error and the webservice is not even
> reached :
>
> Invalid JSON primitive: pText
>
> and this way :
>
>  $.ajax({
>           url: "Publication.asmx/GetPublication",
>           data: "pText=some text",
>           type: "POST",
>           dataType: "json",
>
> });
>
> in which case the webservice is reached but then when the ajax call
> returns I get the following error :
>
> parseerror
>
> What do i need to do to fix this ?
>
> Thanks

Reply via email to