jquery - Error: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:8000' is therefore not allowed access -
I am new to AJAX calls and I want to duplicate the Rottamatos search page. I'm getting the correct JSON file but it will not load on my browser. I am researching and I have not got the solution. Any help would be appreciated.
Here is my code
$ (document) .ready (function () {var apikey = "qvq7jf4n29fv8m8pxqqxxx"; var baseUrl = "http: //api.rottentomatoes .com / api / public / v1.0 "Var movie search * url = baseUrl + '/movies.json?apikey=' + apikey; $ ('form'). Submit (function (evt) {var $ submitButton = $ ('# Submit'); var $ searchField = $ ('#search'); evt.preventDefault (); $ searchField.prop ("disabled", true); $ submitButton.attr ("disabled", is true ) .val ("search ...."); var query = $ SearchField.val (); var riddled movies' RL + 'and amp; q =' + encoder (query); $ .ajax (rotten, function (Data) {if (data.itm.lamp & gt; 0) {$ .each (data.i M, function (i, movie) {movie html + = 'and lieutenant; li class = "grid-25 tablet-grid-50" & gt;' movie html + '& lt; a href = "' + movie Title + '"class =" picture "& gt;'; Movie HTML + = 'img src ="' movie.or posts.original + '"& gt; & lt; / a & gt; & lt; / Li & gt; ';}); / / end each other} {Html = "& lt; p & gt; No photos found which match: "+ + + animal +". & Lt; / P & gt; "} $ ('# movies') .HTML (Movie HTML); $ SearchFilld.Prop" disabled ", false); $ submitButton.attr (" disabled ", incorrect) .val (" search ") ;}}; // and getJSON}); // and click}}; // end ready
You just need .jax to use jsonp.
Here jsfiddle is working
$ .ajax ({dataType:" Jsonp ", url: rotten, breakthrough: search callback});
Comments
Post a Comment