Solved JQuery Ajax and Firefox

October 27, 2010 at 07:04:16
Specs: Windows 7 Ulti
<html>
<head>
<meta content="en-us" http-equiv="Content-Language">
<script src="jquery.js"></script>
<script language="javascript">
function ajax(eventid)
{
var rep = document.getElementById("salesrep");
var finalurl = "eventid=" + eventid + "&salesrep=" + rep.options[rep.selectedIndex].value;
$.ajax({
type: "GET",
url: "occucert.asp",
data: finalurl,
contentType: "application/x-www-form-urlencoded; charset=utf-8",
success: function(msg){
document.getElementById("contents").innerHTML = msg;
//$("div[id=contents]).load(msg);
//alert(msg);
}
});
}
</script>
</head>
<Body>

<p class="auto-style1">Select Sales Rep: <select name="Salesrep" id="Salesrep" onchange="ajax(2359)">
<option value="">Select a Sales Rep</option>

<option value="272">Mike</option>
<option value="201">Matt</option>
<option value="286">Tom</option>
<option value="203">John</option>
<option value="258">Sue<option>
</select></p>
<div id="contents"></div>

</Body>

</html>

the code above will not work with firefox. it works perfectly in IE . i tried regular javascript to put the return value in my <div> and Ajax. Both did not work for firefox. The Ajax component works fine and the return value is there but i cannot seem to load it up in the <div>.

please helppppp...

thanks.


See More: JQuery Ajax and Firefox

Report •


#1
December 12, 2010 at 17:01:37
✔ Best Answer
Try

<p class="auto-style1">Select Sales Rep: <select name="Salesrep" id="Salesrep" onclick="ajax(2359)">

instead of

<p class="auto-style1">Select Sales Rep: <select name="Salesrep" id="Salesrep" onchange="ajax(2359)">


Report •

#2
December 12, 2010 at 17:15:17
To set the result, try:

$('#contents').html(msg);

Also install Firebug for Firefox - look in the 'Console' and see if there's a javascript error.

http://getfirebug.com/


Report •

Related Solutions


Ask Question