I have 2 forms that share a submit button
("#sbtBtn").click(function() {
if($("input[name=license_code]").val()) { //check if #retUser has a value
$("#formOne").submit();
} else if ($("input[name=referred_by_text]").val() || $("input[name=broker_text]").val() || $("input[name=email1]").val()) {
$("#formTwo").submit();
}
});
for "#formOne" I am trying to use jquery's getJSON function to use a script cross domain, its not working.
$("#formOne").validate({
errorElement: "em",
errorPlacement: function(error, element) {
error.appendTo( element.parent("li"));
},
submitHandler: function(form) {
var dataString = $(form).serialize();
$.getJSON("http://www.domain.com/sugar/NT7Lead2.php?data=" + escape($(this).serialize()) + "&callback=?", function(data) {
$("#results").html(data);
});
return false;
},
rules: {
license_code: {
minlength: 3,
maxlength: 39
}
},
messages: {
license_code: {
minlength: "Your License be at Least 3 Characters Including Dashes",
maxlength: "Your License Key Cannot Be More Than 39 Characters Including Dashes"
}
}
});
When I view in firebug, the data is being returned from the script but its not being added to "#results". Is there anything obviously wrong here? Also do I need to include the script in the form action since its in the JSON function? here's the html
<div class="purchaseFormContain" id="currentUser">
<div class="purchaseTH form" id="formOneTH"><h3>Current Users</h3></div>
<form method="post" name="formOne" id="formOne">
<ul class="features">
<li><label for="license_code">Enter Your License Key Here</label></li>
<li><input type="text" name="license_code" /></li>
</ul>
</form>
<div class="clear"></div>
<div id="results"></div>
<!--/retUser purchaseFormContain --></div>
pls help! thx