Note that there are some explanatory texts on larger screens.

plurals
  1. POPost JS data to page B
    text
    copied!<p>I use this piece of JS:</p> <pre><code>$.get( "/upload/number.php", function( data ) { alert( "Data Loaded: " + data ); }); </code></pre> <p>This makes a call to number.php, wich returns a number. In the script above i alert the data to check if this works, and it does. In the alert i see the number.</p> <p>Now i wanna send this number to another page, i tried it this way:</p> <pre><code>$('#file_upload').data('uploadifive').settings.formData = { 'number' : +data }; </code></pre> <p>This is not working, firebug says:</p> <pre><code>SyntaxError: missing } after property list 'number' : data </code></pre> <p>How can i make this work?</p> <p>The complete script:</p> <pre><code>&lt;script type="text/javascript"&gt; //&lt;![CDATA[ $(function() { // Initialiseer uploadifive $('#file_upload').uploadifive({ 'auto' : false, 'checkScript' : '/uploadifive/Sample/check-exists.php', 'onFallback' : function () { window.location = '/home.php'; }, 'method' : 'POST', 'queueID' : 'queue', 'uploadScript' : '/upload/uploadifive.php', 'removeCompleted' : true, 'onUploadComplete' : function (file, data) { console.log(data); } }); // Hang een click-event aan de knop $('#subby').on('click', function () { $.get( "/upload/number.php", function( data ) { alert( "Data Loaded: " + data ); }); // Werk formData van uploadifive bij met de betreffende waarden $('#file_upload').data('uploadifive').settings.formData = { 'number' : data }; // Voer de upload uit $('#file_upload').uploadifive('upload'); }); }); //]]&gt; &lt;/script&gt; </code></pre>
 

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