Hello there I know this has been anwsered many times before, but none of the anwsers help me
am trying to load a jquery plugin to bypass cors during development
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
</head>
<body>
<script>
$(document).ready(function() {
$.get('https://google.com', function(r) {
console.log(r);
});
});
</script>
<script>
(function($) {
$.fn.myPlugin = function() {
$.ajaxPrefilter(function(options) {
if (options.crossDomain) {
options.url = "https://corsproxy.io/?" + options.url;
}
});
return this;
};
}(jQuery));
</script>
<script>
$.myPlugin();
</script>
<script></script>
</body>
</html>
but chrome is always throwing that the plugin is not a function
Uncaught TypeError: $.myPlugin is not a function
I am realy not sure what I am doing wrong here because it seams that the plugin is properly defined?
Thanks for Anwsering and Best Regards