Thanks.. I tried that but I'm getting an error before the webservice
is reached :  "Invalid JSON primitive: pText."

Like I said, my webservice's method expects a string, not a JSON key-
value  pair. I'd be surprised if we can't pass a simple string to a
webservice ?

On 29 jan, 16:24, MorningZ <morni...@gmail.com> wrote:
> Right from the docshttp://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