Note that there are some explanatory texts on larger screens.

plurals
  1. POJQuery AJAX Issue without error
    primarykey
    data
    text
    <p>So I am adding a list of stores to a web page via a jQuery AJAX request. This little utility is not dynamic, just database driven. I have decided to use jQuery/AJAX to transfer the data because when I try to embed PHP in our current PHP CMS, I get a bunch of conflicting errors.</p> <p>The problem I am having is that I am getting a jQuery AJAX error when trying to make the request to the PHP script, and I am not sure why.</p> <p>Here is my AJAX request</p> <pre><code>$(document).ready(function(){ $.ajax({ type:"POST", url:"getStores.php", dataType: "json", success:function(data){ results(data); }, error: function(data) { console.log(data.error); } }); }); </code></pre> <p>The cryptic console error i am getting is this</p> <pre><code>function (){if(c){var a=c.length;m(arguments),i?k=c.length:e&amp;&amp;e!==!0&amp;&amp;(j=a,n(e[0],e[1]))}return this} </code></pre> <p>Here is my PHP code if it will be helpful:</p> <pre><code>//database connection $return_arr = array(); $sql = mysql_query("SELECT * FROM where_to_buy"); while($row = mysql_fetch_array($sql, MYSQL_ASSOC)) { $row_array['store_name'] = $row['store_name']; $row_array['store_url'] = $row['store_url']; array_push($return_arr,$row_array); } echo json_encode($return_arr); </code></pre> <p>I think the problem might be because I wrapping my JSON in an array?</p> <p>EDIT:: JSON output from php script as requested</p> <pre><code>[{"store_name":"Example 1","store_url":"http:\/\/www.example1.com"},{"store_name":"Example 2","store_url":"http:\/\/www.example2.com"}] </code></pre> <p>Thanks for any help!</p>
    singulars
    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