JavaScript
Article
By Sam Deering

$.getScript() loading each character in the url

By Sam Deering
Last chance to win! You'll get a... FREE 6-Month Subscription to SitePoint Premium Plus you'll go in the draw to WIN a new Macbook SitePoint 2017 Survey Yes, let's Do this It only takes 5 min

$.getScript is causing this strange error, I’m not sure why it is causing an error loading each character in the url as a seperate request. I’ve seen this before but not can’t remember why it is doing it. Any ideas?!?! $.getScript() loading each character in the url…

getscript-error

$.getScript('http://domain.com/views/pc/js/ext/jquery.livesearch.min.js', function()
{
      //do something once the script has loaded...
});

But…

Full ajax call works!

$.ajax(
{
    type: 'GET',
    url: 'http://domain.com/views/pc/js/ext/jquery.livesearch.min.js',
    success: function(data)
    {
        log(data);
        //do something once the script has loaded...
    },
    error: function(xhr, textStatus, errorThrown)
    {
        alert('ajax loading error... ... '+widgetId+' '+contentUrl);
        return false;
    }
});

Any ideas???

--ADVERTISEMENT--

Login or Create Account to Comment
Login Create Account
Recommended
Sponsors
Get the most important and interesting stories in tech. Straight to your inbox, daily.
Is it good?Is it good?