Permalink
Browse files

Fixed cross domain issue when setting content type

- Also fixed jsonp fail issues

#947, #1745
  • Loading branch information...
1 parent f0e2b74 commit 17f22b111cef3c2407b4028cbe5586b2df9e6ca3 @NTaylorMullen NTaylorMullen committed Mar 26, 2013
@@ -224,6 +224,8 @@
ajaxDataType: "json",
+ contentType: "application/json; charset=UTF-8",
+
logging: false,
state: signalR.connectionState.disconnected,
@@ -330,6 +332,8 @@
connection.log("Using jsonp because this browser doesn't support CORS");
}
}
+
+ connection.contentType = "application/x-www-form-urlencoded; charset=UTF-8";
}
connection.ajaxDataType = config.jsonp ? "jsonp" : "json";
@@ -395,7 +399,7 @@
global: false,
cache: false,
type: "GET",
- contentType: "application/json; charset=UTF-8",
+ contentType: connection.contentType,
data: {},
dataType: connection.ajaxDataType,
error: function (error) {
@@ -75,7 +75,7 @@
global: false,
cache: false,
type: "GET",
- contentType: "application/json; charset=UTF-8",
+ contentType: connection.contentType,
data: {},
dataType: connection.ajaxDataType,
success: function (data) {
@@ -173,7 +173,7 @@
url: url,
global: false,
type: connection.ajaxDataType === "jsonp" ? "GET" : "POST",
- contentType: connection.ajaxDataType === "jsonp" ? "text/html; charset=UTF-8" : "application/x-www-form-urlencoded; charset=UTF-8",
+ contentType: "application/x-www-form-urlencoded; charset=UTF-8",
dataType: connection.ajaxDataType,
data: {
data: data
@@ -211,7 +211,7 @@
timeout: 1000,
global: false,
type: "POST",
- contentType: "application/json; charset=UTF-8",
+ contentType: connection.contentType,
dataType: connection.ajaxDataType,
data: {}
});
@@ -86,6 +86,7 @@
cache: false,
type: "GET",
dataType: connection.ajaxDataType,
+ contentType: connection.contentType,
success: function (minData) {
var delay = 0,
data;

0 comments on commit 17f22b1

Please sign in to comment.