Note that there are some explanatory texts on larger screens.

plurals
  1. POsplit ajax json response errors in each field
    primarykey
    data
    text
    <p>i used till now AJAX post with normal dataType 'html' , now i convert it and using dataType 'json' ,</p> <p>Now before i used json i split response errors with for each span next to the input field .</p> <p>this is my old ajax succses split errors code using normal datatype 'html' :</p> <pre><code> success: function(data){ var data_array = split('*'); for(var i=0; i&lt;data_array.length-1; i++) { messgae_array = data_array[i].split(':'); $("#"+messgae_array[0]+"_error").html(messgae_array[1]); $("#"+messgae_array[0]).css({"border":"1px solid red"}); } } </code></pre> <p>this is my input on the form</p> <pre><code>&lt;input type="text" id="uname" name="uname" value="" class="inplaceError" /&gt; &lt;span id="uname_error"&gt;&lt;/span&gt; </code></pre> <p>i have more inputs i puted just ex how it look..</p> <p>so every input i have span that holds the errors from the ajax response.</p> <p>and now the problem is my old code know handle html response and not json response , i am javascript/ajax/json newbie , and i dont know how to change the split code so work with json response and not normal html response , any help please?</p> <p><strong>Edit:</strong></p> <p>i fire the errors like this :</p> <pre><code> if(isset($_POST['p']) &amp;&amp; !empty($_POST['p'])) { if($password == $retype) { $random_salt = hash('sha512', uniqid(mt_rand(1, mt_getrandmax()), true)); // Create salted password (Careful with the chilli) $password = hash('sha512', $password.$random_salt); } else { $message['password']='&amp;nbsp;password not match'; } and so on . $message['email']='&amp;nbsp;wrong email'; </code></pre> <p>and my foreach json array for the errors :</p> <pre><code> foreach($message as $key =&gt; $val) { $return = array('error' =&gt; $key, 'message' =&gt; $val ); echo json_encode($return); } </code></pre> <p>so somthing is wrong here with the foreach for the errors its fire wrong as the ajax response code any idea?</p>
    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.
    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