Jump to content

function not calling on onload but calling on onclickPosted: Fri Sep 18, 2009 10


Recommended Posts

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

 

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

}

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

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)?

 

 

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.

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.