Note that there are some explanatory texts on larger screens.

plurals
  1. POGetting the value(x) not defined IN AJAX, web api
    text
    copied!<p>This the Javascript code, I am trying to get the listview of reviews to appear when the use clicks on the movie, But in console I am getting an error for second movie and third that Batman is not defined, or Avatar is not defined,but with Anna Karenina( which has a space ) says Uncaught SyntaxError: Unexpected identifier Why is this happeninG, I have even encoded the URI in PHP PHP code</p> <pre><code> function reviews_get($title=null) { //GET : retrive all the reviews { if (!isset($title)){// check if the ID is specified in the URI $info-&gt;status = 'failure'; $info-&gt;error-&gt;code = 11; $info-&gt;error-&gt;text = 'title not specified in URI'; $this-&gt;response($info, 400); }} { // if the resource exist $this-&gt;load-&gt;database(); $sql = 'SELECT COUNT(Title) AS records FROM reviews WHERE Title = "'.$title.'";'; //$this-&gt;response($sql, 200); $query = $this-&gt;db-&gt;query($sql); $data = $query-&gt;row(); if ($data-&gt;records == "0") { $info-&gt;status = 'failure'; $info-&gt;error-&gt;code = 12; $info-&gt;error-&gt;text = 'Title does not exist or have a resource'; $this-&gt;response($info, 404); } } $this-&gt;load-&gt;database(); $sql = 'SELECT id,Title,review,publisher,rating FROM reviews where Title="'.$title.'";'; $query = $this-&gt;db-&gt;query($sql); $data = $query-&gt;result(); $info-&gt;reviews = $data; $json = json_encode($info); //$info-&gt;bytes = strlen($json); $this-&gt;response($info, 200); } </code></pre> <p>Javascript</p> <pre><code> //Get reviews for a partiluar movie function Getreviewtitle(reviewtitle){ $.ajax({ url: "http://creative.coventry.ac.uk/~4078078/moviereviews/v1.0/index.php/review/reviews/"+reviewtitle, dataType: 'json', success: function(data) { $("#allreviews").empty(); reviewtitle=title; console.log(reviewtitle); $.each(data.reviews, function(i,review){ $('#reviewlist').append('&lt;li&gt;&lt;a href="" data-transition="slide" onclick="Getreviewid('+review.id+')"&gt; '+review.Title+' by '+review.publisher+': Rating: '+review.rating+'&lt;/a&gt;&lt;/li&gt;'); }); $.mobile.changePage("#allreviews"); //show the results page $('#moviereviews').listview('refresh'); }, error: function (response) { var r = jQuery.parseJSON(response.responseText); alert("Message: " + r.error.text); } }); } </code></pre> <p>Link to the site if you want to test is :<a href="http://creative.coventry.ac.uk/~4078078/client3/" rel="nofollow">http://creative.coventry.ac.uk/~4078078/client3/</a> If you click on reviews at the bottom and then click on the movie that the page I want to display and these ar the codes for it</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload