Origin is not allowed by Access-Control-Allow-Origin

Remote Origin Errors with JSONP and jQueryAre you self-harming because your browser is complaining about cross-domain, remote-origin XML requests? As annoying as it can be, the web would be a much nastier place without this restriction that limits what can be pulled from where. You’re probably seeing this exact message in the console/error log of your browser’s development tools:

Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin

Once you understand why you’re getting issues with this, it’s tiresome to always be re-writing this integral function so, like my other free web development resources on here, I’ve saved an example as a gist on GitHub with jQuery and PHP code which you are free to copy, clone or download then use without limitation!

Continue reading

jQuery UI Slider Labels

I was re-shuffling the layout of a content filter of a system that uses jQuery UI and its ThemeRoller and I wanted to save a bit of space while still showing the same amount of information so to add jQuery UI Slider labels, I added the following lines of code into my slider function:

slide: function(event,ui){

To explain; the loop is standard and runs whenever the slider is used, the first two lines of it add the value of the appropriate handle to itself as a label while the last two lines are just adding the the same values to hidden inputs for the form to post. Having the labels different (though still changing) wouldn’t require more than a look-up routine.