TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Abbott
NA
32
0
Pass JSON object to WCF endpoint
Mar 19 2010 2:30 PM
I am trying to send a simple (8 item) structure to WCF. I can't seem to get it correct. Any suggestions on where to look for a solution.
Here's the object declaration & call
Thanks
Abbott
function ContentEntryItem(ContentEntryId,
ContentType,
Date,
ProviderId,
ProviderName,
Title,
Tip,
LinkId,
LinkUrl) {
this.ContentEntryId = ContentEntryId;
this.ContentType = ContentType;
this.Date = Date;
this.ProviderId = ProviderId;
this.ProviderName = ProviderName;
this.Title = Title;
this.Tip = Tip;
this.LinkId = LinkId;
this.LinkUrl = LinkUrl;
}
function UpdateContent() {
var today = new Date();
var contentEntry = new ContentEntryItem(0,
"Sermons",
today,
1,
"Peter Piper",
"The Time Sermon",
"A tip in time",
0,
"~/sermons/20100212.pdf");
AddUpdateContentWCFJSON(contentEntry);
}
function AddUpdateContentWCFJSON(contentEntryItem) {
varJType = "POST";
varJUrl = "Service/JsonContentWcfService.svc/AddUpdateContent";
varJData = '{"ContentEntryItem": "' + contentEntryItem + '"}';
varJContentType = "application/json; charset=utf-8";
varJDataType = "json";
varJProcessData = true;
CallJsonService();
}
function CallJsonService() {
$.ajax({
type: varJType, //GET or POST or PUT or DELETE verb
url: varJUrl, // Location of the service
data: varJData, //Data sent to server
contentType: varJContentType, // content type sent to server
dataType: varJDataType, //Expected data format from server
processdata: varJProcessData, //True or False
success: function(msg) {//On Successfull service call
JsonServiceSucceeded(msg);
},
error: JsonServiceFailed// When Service call fails
});
}
Reply
Answers (
0
)
Welcome to JQuery Forums
Zooming on image hover.