Sim Posted March 14, 2012 Share Posted March 14, 2012 var phrases = new Array(); var i; var boom = false; $(document).ready(function(){ while(boom == false) { $("#proccess_form").mouseup(function () { $("#outcome").html(""); $.ajax({ url: $("#form1").attr("action"), global: false, type: "POST", data: $("#form1").serialize(), dataType: "html", for(i=0;i<=phrases.length;i++) { if(msg != phrases[i]) { $('.phrases').append(msg); boom = true; } else { boom = false; } } }, error: function(msg) { $("#outcome").html(msg); } }); }); } }); SCRIPT1028: Expected identifier, string or number forms.js, line 17 character 5 anyone know how to fix this issue? Quote Link to comment Share on other sites More sharing options...
bluegman991 Posted March 14, 2012 Share Posted March 14, 2012 2 problems. First, you are trying to pass a for loop as a value. Second, you are not specifying an identifier. Quote Link to comment Share on other sites More sharing options...
Djkanna Posted March 14, 2012 Share Posted March 14, 2012 Missing success: function (msg) { perhaps? Quote Link to comment Share on other sites More sharing options...
Sim Posted March 14, 2012 Author Share Posted March 14, 2012 oh snap didnt see I deleted my success thing =)... let me give it a try.. Quote Link to comment Share on other sites More sharing options...
HauntedDawg Posted March 14, 2012 Share Posted March 14, 2012 If you don't come right. Give this a try. var phrases = new Array(); var i; var boom = false; $(document).ready(function() { while(boom) { $("#proccess_form").mouseup(function () { $("#outcome").html(''); $.ajax({ url: $("#form1").attr('action'), type: "POST", data: 'search='+$("#form1").serialize(), dataType: "html", success: function(msg){ phrases.push(msg); for(i = 0; i <= phrases.length; i++) { if(msg != phrases[i]) { $('.phrases').append(msg); boom = false; } else { boom = false; } } }, error: function(msg) { $("#outcome").html(msg); } }); }); } }); Quote Link to comment Share on other sites More sharing options...
Djkanna Posted March 14, 2012 Share Posted March 14, 2012 Warning: OFF TOPIC You in MWG chat!? Well at that time no, I was heading towards a fluffy thing called bed. :) (also off topic) Quote Link to comment Share on other sites More sharing options...
Spudinski Posted March 14, 2012 Share Posted March 14, 2012 Use: $.each(yourVar, function(key, val) { // something }); And PS.: Sending requests within a loop is a VERY bad idea. Also, as a hint, parses is empty... and.... i should have local scope. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.