Reputation: 2038
I'm using jQuery 1.7.1 in a web app running on WebLogic 10.3.2. I do ajax GETs to the server. This all works fine in FF and Chrome, but nothing happens for the ajax events in IE 8. It's as if the doc ready didn't set them up at all.
Here's some of the js:
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="css/messaging.css" />
<link rel="stylesheet" type="text/css" href="css/jquery-ui-1.8.17.custom.css" />
<link rel="stylesheet" type="text/css" href="css/ui.dynatree.css" />
<link rel="stylesheet" type="text/css" href="css/jquery.cluetip.css" />
<link rel="stylesheet" type="text/css" href="css/jquery-ui-timepicker-addon.css" />
<script type="text/javascript" src="js/jquery-1.7.1.js"></script>
<script type="text/javascript" src="js/jquery-ui-1.8.17.custom.min.js"></script>
<script type="text/javascript" src="js/jquery.dynatree.js"></script>
<script type="text/javascript" src="js/jquery.cookies.2.2.0.js"></script>
<script type="text/javascript" src="js/jquery.cluetip.js"></script>
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.js"></script>
<script type="text/javascript" src="js/jquery-ui-sliderAccess.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$.ajaxSetup ({
cache: false,
xhrFields: {
withCredentials: true
},
crossDomain: true
});
...
$('#findSites').click(function() { // Locate HTML DOM element with ID "somebutton" and assign the following function to its "click" event...
searchVal = document.getElementById("searchFor").value;
searchTyp = document.getElementById("searchType").value;
$.get('SiteSearchServlet', {searchFor: searchVal, searchType: searchTyp}, function(responseJson) { // Execute Ajax GET request on URL of "someservlet" and execute the following function with Ajax response JSON...
...
I've tried leaving off the charset, using only cache=false in ajaxsetup - didn't help. The $.get ajax call doesn't execute when the findSites button is clicked.
Can anyone tell me the secret to getting jQuery ajax GETs to work on IE?
Upvotes: 1
Views: 3245
Reputation: 46647
Try using $.ajax instead of $.get, that way you can add an error callback and see why the ajax call is failing.
http://net.tutsplus.com/tutorials/javascript-ajax/5-ways-to-make-ajax-calls-with-jquery/ (see the Finally... section at the end)
Upvotes: 2