Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery function not working - sometimes
    primarykey
    data
    text
    <p>I have 2 identical code blocks, when it is loaded at first from the index in controller it works, but when I submit a form and load this code, my autocomplete isn't working for a field. </p> <pre><code>&lt;link rel="stylesheet" type="text/css" href="&lt;?php echo base_url(); ?&gt;public/blue.css" /&gt; &lt;link rel="stylesheet" type="text/css" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/themes/base/jquery-ui.css" /&gt; &lt;script type="text/javascript" src="&lt;?php echo base_url(); ?&gt;public/jquery-1.6.1.js"&gt;&lt;/script&gt; &lt;script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.9/jquery-ui.js"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function() { alert('workin'); //$(".publish-bottom").hide(); $(".publish-right").hide(); //title field $.ajax({ type: "GET", cache: false, dataType: 'json', url: "publishlinks/search_movies", success: function(response) { alert('response received'); alert(response); $("#title").autocomplete({ source: response, minLength: 2, select: function (event, ui) { var selectedObj = ui.item; var imgFilename = ui.item; imgFilename = imgFilename.value; imgFilename = imgFilename.replace(/ /g,"_"); $(".selected-right").empty(); $(".selected-left").empty(); $(".publish-right").show(); //render selected media $(".selected-left").append('&lt;a href="&lt;?php echo "#"; ?&gt;"&gt; &lt;img class="movie-img" src="&lt;?php echo base_url(); ?&gt;img_test/' + imgFilename + '"&gt;&lt;/a&gt;'); $(".selected-right").append('&lt;h4&gt;' + selectedObj.title + '&lt;/h4&gt;'); $(".selected-right").append(selectedObj.plot); //update publication id $("#movieId").attr("value", selectedObj.movieid); $("#selected-item").attr("value", "selected"); $(".new-movie").show(); //get selected item's publications getPublications(selectedObj); } }).data( "autocomplete" )._renderItem = function( ul, item ) { var imgFilename = item.label; imgFilename = imgFilename.replace(/ /g,"_"); return $( "&lt;li&gt;&lt;/li&gt;" ) .data( "item.autocomplete", item ) .append( '&lt;a&gt;' + '&lt;img src="http://localhost/portal/img_test/' + imgFilename + '" width="40" height="63" /&gt;' + item.title + '&lt;/a&gt;' ) .appendTo(ul); } } }); }); &lt;/script&gt; function search_movies() { $movies = $this-&gt;movie_model-&gt;get_movies(); echo json_encode($movies); } //works fine function index() { $this-&gt;load-&gt;model('user_model'); $data['user'] = $this-&gt;user_model-&gt;get_user($this-&gt;session-&gt;userdata('userid')); $data['loggedIn'] = $this-&gt;is_logged_in() ? true : false; $this-&gt;load-&gt;view('header_view', $data); $this-&gt;load-&gt;view('publish_links_view'); } </code></pre> <p><strong>Code for form submit:</strong></p> <pre><code> //Not working for autocomplete $error['linksError'] = 'You must select an item to publish links for.'; $data['user'] = $this-&gt;user_model-&gt;get_user($this-&gt;session-&gt;userdata('userid')); $data['loggedIn'] = $this-&gt;is_logged_in() ? true : false; $this-&gt;load-&gt;view('header_view', $data); $this-&gt;load-&gt;view('publish_links_view', $error); </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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