Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I think the problem is that you're passing a string value for the data key when in fact it is expecting an object. E.g. -</p> <p>jQuery.ajax({type:"GET", url:"/", data:"?bob=bob&amp;carol=carol",success:function(){console.log(arguments.length);}})</p> <p>Actually hits the URL - stackoverflow.com/?_=1295905818376&amp;?bob=bob&amp;carol=carol</p> <p>Whereas -</p> <p>jQuery.ajax({type:"GET", url:"/", data:{bob:"bob", carol:"carol"},success:function(){console.log(arguments.length);}})</p> <p>Hits the URL - stackoverflow.com/?_=1295906023724&amp;bob=bob&amp;carol=carol</p> <p>(the extra parameter that's turning up is a timestamp that jQuery adds to prevent the response being cached)</p> <p>So I reckon if you change your code to the following it should give you the alerts you are expecting -</p> <pre><code> $.ajax({ type: "GET", url: "ajaxValidate.php", data: {email: fval1.val()), user:fval2.val()}, success: function(msg){ alert(fval1.val()); alert(msg); } }); </code></pre> <p>It's probably then worth bearing in mind that the code in the success callback function will be run at some point in the future and not at that point sequentially in the code. That means that you're probably going to have to rework your validation code to something of the form -</p> <pre><code> "Create an account": function() { var bValid = true; allFields.removeClass( "ui-state-error" ); bValid = bValid &amp;&amp; checkLength( name, "username", 3, 16 ); bValid = bValid &amp;&amp; checkLength( email, "email", 6, 80 ); bValid = bValid &amp;&amp; checkLength( password, "password", 5, 16 ); bValid = bValid &amp;&amp; checkRegexp( name, /^[a-z]([0-9a-z_])+$/i, "Username may consist of a-z, 0-9, underscores, begin with a letter." ); // From jquery.validate.js (by joern), contributed by Scott Gonzalez: http://projects.scottsplayground.com/email_address_validation/ bValid = bValid &amp;&amp; checkRegexp( email, /^((([a-z]|\d|[!#\$%&amp;'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+(\.([a-z]|\d|[!#\$%&amp;'\*\+\-\/=\?\^_`{\|}~]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])+)*)|((\x22)((((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(([\x01-\x08\x0b\x0c\x0e-\x1f\x7f]|\x21|[\x23-\x5b]|[\x5d-\x7e]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(\\([\x01-\x09\x0b\x0c\x0d-\x7f]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF]))))*(((\x20|\x09)*(\x0d\x0a))?(\x20|\x09)+)?(\x22)))@((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?$/i, "eg. john.doe@pokermaps.org" ); bValid = bValid &amp;&amp; checkRegexp( password, /^([0-9a-zA-Z])+$/, "Password field only allow : a-z 0-9" ); var $this = $(this); $.ajax({ type: "GET", url: "ajaxValidate.php", data: "?email="+escape(fval1.val())+"&amp;user="+escape(fval2.val()), success: function(msg){ $( "#users tbody" ).append( "&lt;tr&gt;" + "&lt;td&gt;" + name.val() + "&lt;/td&gt;" + "&lt;td&gt;" + email.val() + "&lt;/td&gt;" + "&lt;td&gt;" + password.val() + "&lt;/td&gt;" + "&lt;/tr&gt;" ); document.forms["regform"].submit(); $this.dialog( "close" ); }, }); }, </code></pre> <p>I've never used the dialog stuff before so I'm not sure what the plugin is expecting the function to return etc., but you're going to want a structure something more like that to support the async call.</p> <p>Hope that helps,</p> <p>Chris</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. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      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