开发者

CodeIgniter - getting the site url prefixed to some anchor tags

开发者 https://www.devze.com 2023-02-19 12:21 出处:网络
I\'ve inherited a project which is just a intranet document storage type of site. There\'s a drop down list of categories and a table that gets filled with the different documents associated with thos

I've inherited a project which is just a intranet document storage type of site. There's a drop down list of categories and a table that gets filled with the different documents associated with those categories. When an option in the drop down is selected jQuery captures it and uses ajax to build a querystring (a CI happy URL) and then it eventually returns a string that is the html for a

I get this back:

<tr><td class='fileName'><a href='xxxxxx.xxxxxx.com/salesadmin/Education/Education-Collection-Process-and-Chargeback-Policy.doc' target='_blank'>Education Collection Process and Chargeback Policy</a><p class='fileDescription'></p></td><td class='fileExtension'><p class=doc>doc</p></td><td class='fileModed'>2010-08-10 07:52:30</td><td class='btn'><a class='btnEditLine' name='5' href='javascript:' title='Click to EDIT: "Education Collection Process and Chargeback Policy"'>Edit</a></td><td class='btn'><a class='btnDeleteLine' name='5' href='javascript:' title='Click to DELETE: "Education Collection Process and Chargeback Policy"'>Delete</a></td></tr>

The href is correct, it is pointing to where the downloadable files are located. But for some reason when I roll over the links in the browser they are being prefixed with the site url:

http://kopmacwwwo1.xxxxxxx.com/InternalAdmin/admin/index/xxxxxx.xxxxxx.com/salesadmin/Education/Education-Collection-Process-and-Chargeback-Policy.doc

I console.log everything right up to where it is inserted into the tbody and it is correct. Is this something CI is doing and if so how do I correct it?

Thanks

Edit: JS Function that is making the ajax call:

// ajax request triggered by catagory drop down menu selection or by other functions
    getCatagoriesItems: function ()
    {

        // call function in master.js file to block the whole web page using blockUI
        blockPage();

        // unbind previous evant handlers to edit and delete buttons to free memory (not sure if you have to do this, but better safe than sorry)
        $(".btnEditLine").unbind();
        $(".btnDeleteLine").unbind();

        // get base url of current site
        var baseurl = $("#site_url_for_ajax").val();

        // get admin type
        var adminType = $("#admin_type").val()

        // get catagory id
        var catID = $("#catagoryDropDownList option:selected").attr("id");

        // get the id of the selected item from the drop down list. This will correspond with the table name in the database
        var queryString = baseurl + "admin/ajaxCatagorySelection/" + catID + "/" + adminType;


        // run AJAX GET
        $.get(queryString, function(data)
        {
            // push data into obj var
            var obj = jQuery.parseJSON(data);

            // dump data into table when request is successful
            $("#dataResultsTable tbody").html(JSONParser.parseAdminDropDownSelectedJSON(obj));

            // rebind event handlers to edit buttons
            bindEditButtonEventListener();

            // rebi开发者_开发百科nd event handlers to delete buttons
            bindDeleteButtonEventHandler();

            // unblock page when done
            $.unblockUI();
        });
    },


Do you use site_url() or anchor()? As described HERE they both prefix the site url from the config file.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号