Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

JavaScript Forum


You are currently viewing our JavaScript Forum as a guest. Please register to participate.
Login



Reply
Old 03-16-2008, 11:19 AM AJAX truble
Experienced Talker

Posts: 32
Trades: 0
Hello, I'm creating an AJAX driven site, and I have a problem... I need to have an "live" url, wich isn'c case in my simple code... I need it, because i will need to use mod_rewrite later (client's request).

Here's what I've got so far:

PHP Code:
function loadPage(page)
    {
    if (
page == "" || page == null)
        
page "home.php";
    var 
xmlHttp;
    try
        {
        
xmlHttp=new XMLHttpRequest();
        }
    catch (
e)
        {
        try
            {
            
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
            }
        catch (
e)
            {
            try
                {
                
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
                }
            catch (
e)
                {
                
alert("Your browser does not support AJAX!");
                return 
false;
                }
            }
        }
    
    
xmlHttp.onreadystatechange=function()
        {
        if(
xmlHttp.readyState==4)
            {
            
document.getElementById("main-content-container").innerHTML xmlHttp.responseText;
            }
        }
    
xmlHttp.open("GET","content/" page,true);
    
xmlHttp.send(null);
    } 
Then I load content with "<a href='javascript:loadPage("example.php")'>test</a> " wich works just fine, but i cann't use method POST with this (or at least don't know how)... So there are multiple problems, and any help would be appriciated...

Thanks in advance
lotar_vk is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 03-17-2008, 07:38 AM Re: AJAX truble
chrishirst's Avatar
Missing! presumed drunk.

Posts: 41,517
Name: Chris Hirst
Location: Blackpool. UK
Trades: 0
xmlHttp.open("POST","content/" + page,true);

Be aware that POST can cause problems occasionally when trying to use it with non-existant URIs (eg rewritten ones)
__________________
Chris. ->> Links are advertising NOT optimising!! <<-
A foolish consistency is the hobgoblin of little minds
Thought for today:- I SEO the only industry where all the cowboys are Indians?
chrishirst is offline
Reply With Quote
View Public Profile Visit chrishirst's homepage!
 
Reply     « Reply to AJAX truble
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.20761 seconds with 12 queries