Reputation: 637
i am using ajax jquery method to pass value to server, but my problem is i am using some value with single quote
'
and it's give me error ,
ClientManager = "Client's Manager " <== here i am passing value with ' (single quote)
data: "{projectSoid': '" + ProjectId + "','startDate': '" + StartDate + "','endDate': '" + EndDate + "','clientManager': '" + ClientManager + "'}",
and ajax jquery method, Error give me error :-
Message: Invalid object passed in, ':' or '}' expected. ........
infect i want all fields allows with ' (single quote)
what's the best soulution to passdata as jQuery Ajax Methods's data : {
Upvotes: 2
Views: 1683
Reputation: 94499
Try defining an object literal, instead of concatenating a String.
data: {
"projectSoid": ProjectId,
"startDate": StartDate,
"endDate": EndDate,
"clientManager": ClientManager
},
//other entries
Upvotes: 2