Please upgrade here. These earlier versions are no longer being updated and have security issues.
HackerOne users: Testing against this community violates our program's Terms of Service and will result in your bounty being denied.

[Solved] 404 Page Not Found Errors - AJAX Only

2»

Comments

  • @peregrine said:
    you might want to console log value of the variable urlFormat

    Oh right... I console.logged the variable, but it was displaying the cached file and I was staring at the screen for too long to realize what I was looking at. :/

    This is what is in the console for that variable:
    urlFormat: /{Path}

    Using:

    var urlFormat = gdn.definition("UrlFormat", "/{Path}");
    console.log("urlFormat: ", urlFormat);
    

    not sure but possibly config statement with webroot might help.

    I just added this to config:

    $Configuration['Garden']['WebRoot'] = FALSE; // You can set this value if you are using htaccess to direct into the application, but the correct webroot isn't being recognized.
    

    I haven't seen any changes yet, but I'll keep researching that angle.

    Thanks for your help...

  • The gdn.url() method is getting the path from gdn.definition():

    var urlFormat = gdn.definition("UrlFormat", "/{Path}");
    

    That one says that it's getting info from hidden inputs on the page:

    // Grab a definition from hidden inputs in the page
    gdn.definition = function(definition, defaultVal, set) {
        if (defaultVal == null)
            defaultVal = definition;
    
        var $def = $('#Definitions #' + definition);
        var def;
    
        if(set) {
            $def.val(defaultVal);
            def = defaultVal;
        } else {
            def = $def.val();
            if ($def.length == 0)
                def = defaultVal;
        }
    
        return def;
    }
    

    I listed all the hidden inputs in the browser console, but don't see one with the ID that gdn.definition() is looking for.

    var urlFormat = gdn.definition("UrlFormat", "/{Path}");
    

    That's going to turn into:

    def = $('#Definitions #UrlFormat').val()
    

    And since those IDs don't exist on the page (from what I can tell), it's going to return just /{Path}.

    Does anyone know where #Definitions #UrlFormat is supposed to be? Could it be something that Cloudflare might be filtering out due to being embedded in a comment or something like that?

  • I had another thought -- since the IDs are missing, maybe it's a template problem. I tried switching the theme to a default one and it suddenly worked.

    I'll look at the custom theme and post an update here so that the next person will have an answer.

  • Fixed it -- my custom theme was missing this line:

    {asset name="Foot"}
    

    That outputs the hidden inputs that set the UrlFormat and other settings.

  • peregrineperegrine MVP
    edited July 2014

    nice find.

    funny I almost posted this, which could have possibly helped

    http://vanillaforums.org/discussion/comment/188810/#Comment_188810

    @linc give this man a solutionsayer badge :)

    I may not provide the completed solution you might desire, but I do try to provide honest suggestions to help you solve your issue.

  • Yes you need that line.

    var checkUrl = gdn.url('/dashboard/user/emailavailable');

    does exactly what it is supposed to. gdn.url will resolve the url as long as it has the right info.

    I surprised many more thing weren't broken too. You need transient key for a lot of things.

    grep is your friend.

  • LincLinc Admin

    @peregrine already has it ;)

Sign In or Register to comment.