Monday, June 3, 2024
 Popular · Latest · Hot · Upcoming
29
rated 0 times [  36] [ 7]  / answers: 1 / hits: 22477  / 15 Years ago, fri, may 1, 2009, 12:00:00

I have basically this on a 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 it should do (and does fine on Firefox) is when you type a username in to the #username field, it will run /ajax/ldap_search.php?cn=$username, which searches our company's ldap for the username and returns it's raw context and a formatted version of the context like this:



<result>
<display>Staff -&gt; Accounting -&gt; John Smith</display>
<context>cn=jsmith,ou=Accounting,ou=Staff,ou=Users,o=MyOrg</context>
</result>


The formatted version (display) goes to the div #ajax-context and goes to the hidden input #context. (Also, the -> are actually - & g t ; (without spaces)).



However, on IE the div stays stuck on Searching... and the hidden input value stays blank.



I've tried both .get and .post and neither work. I'm sure it's failing on the .get because if I try this, I don't even get the alert:



$.get(/ajax/ldap_search.php, {cn: $(#username).val()}, function() {
alert(Check);
});


Also, IE doesn't give me any script errors.



Edit: Added $(document).ready(function() {, the .blur was already in it in my code, but I forgot to include that in my post.



Edit 2: The request is being sent and apache2 is receiving it:



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

More From » jquery

 Answers
34

Problem was in the ldap_search.php file.
I had this (based on an example I read on someone's blog):



header(content-type:application/xml-xhtml;charset=utf-8);


It actually needed to be this for IE to read it properly:



header(content-type:application/xml;charset=utf-8);


God, I hate IE.


[#99615] Sunday, April 26, 2009, 15 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
yulissamirandah

Total Points: 493
Total Questions: 115
Total Answers: 94

Location: Lebanon
Member since Sun, Aug 2, 2020
4 Years ago
yulissamirandah questions
Fri, Jun 17, 22, 00:00, 2 Years ago
Wed, Aug 26, 20, 00:00, 4 Years ago
Tue, Jan 28, 20, 00:00, 4 Years ago
Mon, Nov 11, 19, 00:00, 5 Years ago
;