Note that there are some explanatory texts on larger screens.

plurals
  1. POI am having trouble using jquery to submit a form. It was working before;/
    primarykey
    data
    text
    <p>When a user clicks a link it uses jquery ajax to submit a form to go to paypal. It is not working for some reason. I appreciate any help.</p> <p>The HTML link:</p> <pre><code>&lt;a href="#" onClick="javascript:go_paypal();"&gt;Paypal&lt;/a&gt; </code></pre> <p>The JS function:</p> <pre><code>function go_paypal() { data = 'req_paypal=1'; $.blockUI({ message: '&lt;h1&gt; Going to Paypal...&lt;/h1&gt;',css:{background:'#000'} }); $.ajax({ type: "POST", url: "index.php", data: data, success: function(data) { $("#paypal_form").html(data); $("#payPalForm").submit(); } , error: function() {$.unblockUI(); alert('Unable to communicate to server.'); } }); return false; } </code></pre> <p>The PHP code:</p> <pre><code>if(isset($_POST['req_paypal']) &amp;&amp; $_POST['req_paypal'] == 1 ) { $sql = 'INSERT INTO `transactions` (id,type,ip,time,ammount,status) VALUES (NULL,1,\''.$_SERVER['REMOTE_ADDR'].'\',\''.time().'\',\''.$global['paypal_prod_amount'].'\',0) '; echo $sql; // $sql2 = 'INSERT INTO `users` (id,email,password,referred_by,referrals) VALUES ('',)'; mysql_query($sql); $id = mysql_insert_id(); $html = ' &lt;form action="https://www.sandbox.paypal.com/cgi-bin/webscr" method="post" id="payPalForm"&gt; &lt;input type="hidden" name="item_number" value="One Year of Imgur Pro"&gt; &lt;input type="hidden" name="cmd" value="_xclick"&gt; &lt;input type="hidden" name="no_note" value="1"&gt; &lt;input type="hidden" name="business" value="'.$global['paypal_email'].'"&gt; &lt;input type="hidden" name="custom" value="'.base64_encode($id).'"&gt; &lt;input type="hidden" name="currency_code" value="USD"&gt; &lt;input type="hidden" name="return" value="'.$global['paypal_return'].'"&gt; &lt;input name="item_name" type="hidden" id="item_name" value="One Year of Imgur Pro" &gt; &lt;input name="amount" type="hidden" id="amount" value="'.$global['paypal_prod_amount'].'" &gt; &lt;/form&gt; '; echo $html;exit; } </code></pre>
    singulars
    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.
 

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