[
https://issues.apache.org/jira/browse/CB-208?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13196939#comment-13196939
]
Alan Neveu commented on CB-208:
-------------------------------
Here is the serviceProxy function I am using that calls the JQuery $.ajax
function. This function, in turn, uses the JSON2.js script that I have attached
to this case.
// *** Service Calling Proxy Class
function serviceProxy(serviceUrl) {
var _I = this;
this.serviceUrl = serviceUrl;
// *** Call a wrapped object
this.invoke = function (method, data, callback, error, bare) {
// *** Convert input data into JSON - REQUIRES Json2.js
var json = JSON2.stringify(data);
//json = data;
// *** The service endpoint URL
var url = _I.serviceUrl + method;
$.ajax({
url: url,
data: json,
type: "POST",
processData: false,
contentType: "application/json",
timeout: 20000,
dataType: "json", // not "json" we'll parse
success:
function (res) {
if (!callback) return;
// *** Use json library so we can fix up MS AJAX dates
var result = JSON2.parse(res);
// *** Bare message IS result
if (bare)
{ callback(result); return; }
// *** Wrapped message contains top level object node
// *** strip it off
callback(result);
},
error: function (xhr) {
if (!error) return;
if (xhr.responseText) {
var err = JSON2.parse(xhr.responseText);
if (err)
error(err);
else
error({ Message: "Unknown server error." })
}
return;
}
});
}
}
> WP7 + JQuery call to $.ajax does not work
> -----------------------------------------
>
> Key: CB-208
> URL: https://issues.apache.org/jira/browse/CB-208
> Project: Apache Callback
> Issue Type: Bug
> Components: WP7
> Affects Versions: 1.4.0
> Environment: VS.NET 2010, Using the latest code for the 1.4.0 release
> candidate, plus a fairly simple custom $.ajax function.
> Reporter: Alan Neveu
> Assignee: Jesse MacFadyen
> Attachments: json2.js
>
>
> My own $.ajax function works great all by itself, but with phonegap-1.4.0.js
> present my $.ajax calls get hi-jacked and errors occur in that last function
> in phonegap-1.4.0.js. If I comment out that whole function, my $.ajax calls
> work just great. I need my custom $.ajax calls because they use some custom
> JSON code written by Rick Strahl that properly deals with Microsoft formatted
> dates going in and out of ASMX web services that use JSON for serialization.
> It looks like the error is happening on the line that says:
> return this.wrappedXHR.send(data);
> Is there any way I can disable the hi-jacking of $.ajax calls without
> modifying phonegap-1.4.0.js?
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators:
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira