CodeIgniter - 将网站网址添加到某些锚标记前面

时间:2011-03-23 18:51:13

标签: codeigniter

我继承了一个项目,它只是一个内部网文档存储类型的站点。有一个下拉列表的类别和一个表格,其中填充了与这些类别相关的不同文档。当选择下拉列表中的选项时,jQuery捕获它并使用ajax构建查询字符串(CI快乐URL),然后它最终返回一个字符串,该字符串是

的html

我得到了回复:

< tr>< td class ='fileName'>< a href ='xxxxxx.xxxxxx.com / salesadmin / Education / Education-Collection-Process-and-Chargeback-Policy.doc'target =' _blank'>教育收集流程和退款政策< / a>< p class ='fileDescription'>< / p>< / td>< td class ='fileExtension'>< p class = doc&gt ; doc< / p>< / td>< td class ='fileModed'> 2010-08-10 07:52:30< / td>< td class ='btn'>< a class = 'btnEditLine'name ='5'href ='javascript:'title ='点击编辑:“教育收集流程和退款政策”'>编辑< / a>< / td>< td class ='btn' >< a class ='btnDeleteLine'name ='5'href ='javascript:'title ='点击删除:“教育收集流程和退款政策”'>删除< / a>< / td>< ; / TR>

href是正确的,它指向可下载文件所在的位置。但由于某种原因,当我翻阅浏览器中的链接时,它们会以网站url为前缀:

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

我console.log所有内容都直到插入到tbody的位置,这是正确的。这是CI正在做的事情,如果是这样,我该如何纠正呢?

由于

编辑:正在进行ajax调用的JS函数:

// 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();

            // rebind event handlers to delete buttons
            bindDeleteButtonEventHandler();

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

1 个答案:

答案 0 :(得分:0)

您使用site_url()还是anchor()?如上所述HERE,它们都在配置文件中为站点URL添加前缀。