Jquery.get / .post doesn't work on 7 or 8, works fine in ff
I have basically this on the page:
<script type="text/javascript">
function refresh_context() {
$("#ajax-context").html("Searching...");
$.get("/ajax/ldap_search.php", {cn: $("#username").val()}, function(xml) {
$("#ajax-context").html($("display", xml).text());
$("#context").val($("context", xml).text());
}, 'xml');
}
$(document).ready(function() {
$("#username").blur(refresh_context);
});
</script>
<input type="text" name="username" id="username" maxlength="255" value="" />
<input type="hidden" name="context" id="context" value=""/>
<div id="ajax-context"></div>
What should it do (and works fine in Firefox), when you enter the username in the #username field, it will run / ajax / ldap _search.php? Cn = $ username, which our company searches for ldap for the username and returns it The original context and formatted version of the context as follows:
<result>
<display>Staff -> Accounting -> John Smith</display>
<context>cn=jsmith,ou=Accounting,ou=Staff,ou=Users,o=MyOrg</context>
</result>
The formatted version (display) goes into div # ajax-context and goes to hidden input #context. (Also, → is actually "& gt;" (without spaces)).
However, in IE, the div stays on “Search ...”, and the hidden input value remains blank.
.get, .post . , .get, , :
$.get("/ajax/ldap_search.php", {cn: $("#username").val()}, function() {
alert("Check");
});
, IE script.
: "$ (document).ready(function() {",.blur , .
2: , apache2 :
10.135.128.96 - - [01/May/2009:10:04:27 -0500] "GET /ajax/ldap_search.php?cn=i_typed_this_in_IE HTTP/1.1" 200 69
, Ajax- ?
, jQuery, DOM $(document).ready. , , DOM, , , div "..."
<script type="text/javascript">
function refresh_context() {
$("#ajax-context").html("Searching...");
$.get("/ajax/ldap_search.php", {cn: $("#username").val()}, function(xml) {
$("#ajax-context").html($("display", xml).text());
$("#context").val($("context", xml).text());
}, "xml"); // As pointed out, you should specify the return type
}
$(document).ready(function() {
$("#username").blur(refresh_context);
});
</script>
$( "display", xml).text()
, : $(xml).find( "display" ). text()
, ? , ? ,
function refresh_context() {
$("#ajax-context").html("Searching...");
$.get("/ajax/ldap_search.php", {cn: $("#username").val()}, function(xml) {
$("#ajax-context").html($("display", xml).text());
$("#context").val($("context", xml).text());
}, "xml"); // As pointed out, you should specify the return type
}
function refresh_context() {
$("#ajax-context").html("Searching...");
$.get("/ajax/ldap_search.php", {cn: $("#username").val()}, function(xml) {
var displayXml = $("display", xml).text();
$("#ajax-context").html(displayXml);
var contextXml = $("context", xml).text();
$("#context").val(contextXml);
}, "xml"); // As pointed out, you should specify the return type
}
script.