Question

I have the following website up and running: www.posti.sh The website is actually on www.myskoob.com/postish/, but I use domain forwarding so that when the user types in www.posti.sh it stays that way and does not change to www.myskoob.com/postish/. You can try out the website. It is generally about posting something and uses jQuery ajax to let the user perform posting. Feel free to test it.

Here's the problem:

While visiting www.myskoob.com/postish/, posting works fine - all ajax calls seem to work. However, when I go to www.posti.sh, it does not work, although it accesses the same files - I cannot understand why.

There are two ways of forwarding - one is frame forwarding (which then works) and the other is URL-hiding, which is a much cleaner way because that way the URL actually changes with different pages that are opened.

Anybody knows a reason why URL-hiding does not work? I tried to echo out something on the php file that is called by ajax and it doesn't return anything, so the problem seems to be that ajax cannot connect to that file.

Thank you for your help!

Dennis

UPDATE 1

Please see ajax code here:

//Post
    $.ajax({
        type: 'POST',
        url: 'action/post.php',
        data: 'posttext='+posttext+'&imageurl='+imageurl+'&randomcode='+randomcode,
        success: function(post){
            //Do something here
        }
    }).error(function(){
        //Say it could not post
        alert('The post could not be sent - please try again later.');
    });
Was it helpful?

Solution

Are the domains hard-coded into your ajax requests? Because you cannot do a typical ajax request to a different domain due to same origin policy in web browsers.

One work around would be to not hard-code the domain in the ajax logic, just use a relative path. ie:

Instead of$.load('http://mydomain.com/search/results.json'); use $.load('/search/results.json');

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top