habib009pk Posted September 18, 2009 Share Posted September 18, 2009 Dear friends, I am facing a problem, I am working on ajax and i want to get the desired result on onload of the body. and i am using the code: <script language="javascript" type="text/javascript"> window.onLoad = show_images(<?php echo $lotid; ?>); </script> which called the same function easily but the response of ajax is not coming on the desired div. so the error message appears i.e. Done, But with an error. but when i called the same function on the onclick event the result is 100% correct and i got the response from the ajax please help me what is i am missing through onload body way that i cannot get the desired result. Waiting for your reply. Thanks and Regards Quote Link to comment Share on other sites More sharing options...
corbin Posted September 18, 2009 Share Posted September 18, 2009 When ever you do that assignment, you're assiging the return of the show_images call to window.onload. (Also, isn't it window.onload?) Easiest solution: window.onload = function() { //show_images here } Quote Link to comment Share on other sites More sharing options...
habib009pk Posted September 18, 2009 Author Share Posted September 18, 2009 i can't under stand little bit is it in this way if i am not wrong window.onload = function() { show_images(<?php echo $lotid; ?>); } but i tired this as well it is not working Regards Quote Link to comment Share on other sites More sharing options...
RichardRotterdam Posted September 18, 2009 Share Posted September 18, 2009 The onload event is correct right now so your problem lies elsewhere. More details are required in order to find out what it exactly is that goes wrong. Here are a couple of details that might help finding out what it is. 1. What does your show_images() function look like? 2. What does your source look like when you check it in the browser (no php) 3. Do you have firebug or some other js debugging tool for your browser if so do you receive any javascript error and what is the error? 4. What does the URL look like you request using Ajax (try an alert or console.log in firebug)? Quote Link to comment Share on other sites More sharing options...
habib009pk Posted September 19, 2009 Author Share Posted September 19, 2009 Hi Dear Just for check i also load this page in Firefox and also for the javascript debugger in firebug but it is working as per requirement in Firefox. There is any problem their. Now the problem arises in IE That it is not working in IE. Is it any particular solution for the ajax response in IE on onload calling function Regards. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.