Note that there are some explanatory texts on larger screens.

plurals
  1. POjquery with .getJSON
    primarykey
    data
    text
    <p>I have 2 forms that share a submit button</p> <pre><code>("#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(); } }); </code></pre> <p>for "#formOne" I am trying to use jquery's getJSON function to use a script cross domain, its not working.</p> <pre><code>$("#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()) + "&amp;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" } } }); </code></pre> <p>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</p> <pre><code>&lt;div class="purchaseFormContain" id="currentUser"&gt; &lt;div class="purchaseTH form" id="formOneTH"&gt;&lt;h3&gt;Current Users&lt;/h3&gt;&lt;/div&gt; &lt;form method="post" name="formOne" id="formOne"&gt; &lt;ul class="features"&gt; &lt;li&gt;&lt;label for="license_code"&gt;Enter Your License Key Here&lt;/label&gt;&lt;/li&gt; &lt;li&gt;&lt;input type="text" name="license_code" /&gt;&lt;/li&gt; &lt;/ul&gt; &lt;/form&gt; &lt;div class="clear"&gt;&lt;/div&gt; &lt;div id="results"&gt;&lt;/div&gt; &lt;!--/retUser purchaseFormContain --&gt;&lt;/div&gt; </code></pre> <p>pls help! thx</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