RubbleFord
RubbleFord

Reputation: 7646

Jquery Ajax to [WebMethod]

I'm posting the following to an asp.net [Webmethod] using jquery via the $.ajax method. I've trapped the data being sent over the wire.

{number:01502,numberTypeId:2,companyId:531}

I've break pointed inside the [Webmethod] and the number is being returned as 1502 even though the parameter type is string, I'm guessing this has something to do with the deserialisation.

Can anyone shed any light. ( I've tried wrapping it in quotes before transmission )

Thanks

Upvotes: 0

Views: 292

Answers (1)

David M
David M

Reputation: 72930

In JSON serialization, strings need to be delimited with double quotes:

{number:"01502",numberTypeId:2,companyId:531}

That's the issue.

Upvotes: 4

Related Questions