title: unexpected token error calling a function in a callback
body: <p>on the call back after the ajax call in qm150_submit $.post ....
  I want to call a second function called 'send_email'  (which also has a callback called 'success_callback'</p>
  
  <p>I am getting an error here</p>
  
  <pre><code>function () {send_email(fromName,fromEmail,toEmail,subject,message,success_callback) };
  </code></pre>
  
  <p>error: Uncaught SyntaxError: Unexpected token )</p>
  
  <p>here is the code :</p>
  
  <pre><code>function qm150_submit($title, $name, $email, $description, $send_email) {
  
    $.post('&lt;?PHP print API_SUBMIT; ?&gt;', { "title": $title, "name": $name, "email": $email, "description": $description },
      function (data) {          // callback function after API_SUBMIT
  
      // Send email with a link to their collection
        if ($send_email) {
  
          // parameters for the send_email() ajax function
  
          var subject = "subject";
          var collection_id = data.collection_id;  // data is json returned from the ajax above
          var toEmail = $email
          var message = "&lt;?PHP print SHARE_COLLECTION;?&gt;"+collection_id;
          var fromEmail = "&lt;?PHP print EMAIL_FROM_EMAIL; ?&gt;";
          var fromName = "&lt;?PHP print EMAIL_FROM_NAME; ?&gt;";
  
          var success_callback = function (results) { 
            alert('send_email has returned with: '+results);
          };
  
          alert('I am now calling the send_email');
          function () {send_email(fromName,fromEmail,toEmail,subject,message,success_callback) };
  
        }
      });
          // missing a curly bracket ? no! note  double indentation of the anonymous function (data) is a continuation of first statement
  }
  </code></pre>
  
  <p>edit: and the code for the send_email()</p>
  
  <pre><code>function send_email(fromName,fromEmail,toEmail,subject,message,success_callback) {
    alert('send_email called');
    $.ajax({
      type: 'post',
      url: '&lt;?PHP print API_SHARE_EMAIL;?&gt;',
      data: 'fromName=' + fromName + '&amp;fromEmail=' + fromEmail + '&amp;toEmail=' + toEmail + '&amp;subject=' + subject + '&amp;message=' + message,
      dataType:'json',
      success: success_callback
    });
    alert('send_email finished');
    return true;
  }
  </code></pre>