Welcome Guest, Not a member yet? Register   Sign In
[Solved] Setting url in a .js file
#1

(This post was last modified: 11-02-2016, 03:21 AM by wolfgang1983.)

I have set my url in a js file


Code:
assets

assets > jquery > common.js



And I have a controller called Filemanager.php


Code:
application

application > controllers > Filemanager.php


When I try click on my button which trys to launch modal. It gives the wrong location and a 404 error


The url out puts

Code:
http://localhost/project-1/question/filemanager

How ever should only produce

Code:
http://localhost/project-1/filemanager


assets > jquery > common.js


Code:
$(document).ready(function() {
    $(document).delegate('img[data-toggle=\'image\']', 'click', function() {
        $('#modal-image').remove();
        $.ajax({
            url: 'filemanager',
            dataType: 'html',
            success: function(html) {
                $('body').append('<div id="modal-image" class="modal">' + html + '</div>');
    
                $('#modal-image').modal('show');
            }
        });
    });    
});   


Routes.php


Code:
$route['filemanager'] = 'filemanager/index';


Any idea in how to make sure it gets the right url I cannot use base_url in a js file.

Attached Files Thumbnail(s)
   
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Messages In This Thread
[Solved] Setting url in a .js file - by wolfgang1983 - 11-01-2016, 08:53 PM
RE: Setting url in a .js file - by salain - 11-01-2016, 10:45 PM
RE: Setting url in a .js file - by wolfgang1983 - 11-02-2016, 12:34 AM
RE: Setting url in a .js file - by salain - 11-02-2016, 02:40 AM
RE: Setting url in a .js file - by InsiteFX - 11-02-2016, 03:07 AM
RE: Setting url in a .js file - by wolfgang1983 - 11-02-2016, 03:20 AM
RE: Setting url in a .js file - by InsiteFX - 11-02-2016, 09:51 AM



Theme © iAndrew 2016 - Forum software by © MyBB