Auto redirect within ajax?!

I’m trying to figure out how to make this line:

<a href="#" onclick="load('ajax.php?ga=mailboxresult&amp;cn=user&amp;nx=sent','contentarea');return false;">Go back</a>

Happen automatic without having to hit a link…

I have tryid to insert this:

<script type="text/javascript">
   load('ajax.php?ga=mailboxresult&amp;cn=user&amp;nx=sent','contentarea');
</script>

But nothing happend… Any ideas is appreciated :slight_smile:

The jQuery load() method is designed to retrieve content from another page not redirect, javascript has a build in function designed to do this

<a href="#" onclick="window.location='ajax.php?ga=mailboxresult&amp;cn=user&amp;nx=sent';">Go back</a>

Yes, but this does not load the content within the “contentarea” and does not do it automatic?! Its not a redirection I’m looking for but an automatic load…

Are you using jQuery for your code library, or something else?

If you let us browse to a test page with your current code, we will have a working solution for you in a very short time.

Yes, I’m using jQuery!

Then the following should work, assuming that contentarea is an id attributed section on your page.


$(function () {
    $('#contentarea').load('ajax.php?ga=mailboxresult&amp;cn=user&amp;nx=sent');
});

For full details, see the load documentation page.