Reputation: 13
I've seen a few people with an issue like mine but most of the fixes don't seem related. I have the following jquery that takes a submitted form, encypts pass with SHA256, serializes the form into a JSON object and then uses json stringify to format the json to a plaintext format for passing to an ASPX service. The service returns XML. This works fine on Firefox, Chrome, Safari, Opera, iOS Safari, Blackberry, and the default Android browser. On IE it always calls the error. Does anyone have any ideas here?
$(function() {
$('form').submit(function() {
$('#password').val($.sha256($('#password')));
var jsonTest = JSON.stringify($('form').serializeObject());
$('#result').text(jsonTest);
$.ajaxSetup({cache: "false"});
$.ajax({
type: "POST",
url: "http://mydomain.com/JSONService.asmx/WebRequest",
data: "request=" + jsonTest,
contentType: "application/x-www-form-urlencoded; charset=utf-8",
crossDomain: true,
dataType: "xml",
success: function(xml){
var myVals = $(xml).find('string').text();
$('#result').text(myVals);
alert(myVals);
},
error: function(XMLHttpRequest, textStatus, errorThrown) {
alert("Error: " + errorThrown);
}
});
return false;
And my (relevant) HTML:
<!doctype html>
<!-- Conditional comment for mobile ie7 blogs.msdn.com/b/iemobile/ -->
<!--[if IEMobile 7 ]> <html class="no-js iem7" lang="en"> <![endif]-->
<!--[if (gt IEMobile 7)|!(IEMobile)]><!--> <html class="no-js" lang="en"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<title>Test Form</title>
<meta name="description" content="">
<!-- Mobile viewport optimization h5bp.com/ad -->
<meta name="HandheldFriendly" content="True">
<meta name="MobileOptimized" content="320">
<meta name="viewport" content="width=device-width">
<!-- Mobile IE allows us to activate ClearType technology for smoothing fonts for easy reading -->
<meta http-equiv="cleartype" content="on">
<!-- more tags for your 'head' to consider h5bp.com/d/head-Tips -->
<!-- Main Stylesheet -->
<link rel="stylesheet" href="css/style.css">
<!-- All JavaScript at the bottom, except for Modernizr which enables HTML5 elements & feature detects -->
<script src="js/libs/modernizr-2.0.6.min.js"></script>
</head>
<body>
<div id="container">
<div id="main" role="main">
<div id="logBox">
<img alt="Logo" src="img/logo.png" style="margin-left: 5px;" />
<div id="blackHead">Please Sign-In To Continue</div>
<form name="login" method="post" action="#">
<label for="sessionemail">Email</label><br />
<input autofocus="autofocus" autocapitalize="off" maxlength="150" id="sessionemail" name="sessionemail" title="Your email" type="text" value="" class="inputText" /><br />
<br />
<label for="password">Password</label><br />
<input type="password" name="password" id="password" title="Password" value="" class="inputText" /><br />
<br />
<input type="hidden" name="sessionid" id="sessionid" value="<?php echo $sessionNumber ?>" />
<input type="hidden" name="subtocall" id="subtocall" value="g2.web.login.sub" />
<input type="submit" value="Sign-In" name="submit" class="submitBox" />
</form>
<div id="greyFoot">Forgot your password? <a href="#">Click here now!</a><br />
<pre id="result">
</pre>
</div><!-- end #greyFoot -->
</div><!-- end #logBox -->
</div><!--end #main -->
</div> <!--! end of #container -->
</body>
</html>
I really appreciate any and all help. Firebug is not throwing up any errors and I really am stumped as to how it works on everything but IE. I am used to this in CSS but not JS!
EDIT - I have changed the error to show errorThrown, which says "No Transport".
Upvotes: 1
Views: 1417
Reputation: 1470
im not sure if this a local domain request or not but if its a remote request ie does not support cross domain ajax calls regardless if its getJSON or not. learned that the hard way...
Upvotes: 1