title: Tableau Embed with jQuery and PHP passing parameters
body: <p>I generally use Wordpress when building my internally facing dashboards with Tableau, but that will not work in this case so I am starting from scratch. I'm a novice with PHP and slightly above novice with jQuery, but I know my way around HTML. I need to pass an Okta javascript parameter into a Tableau embed. Below is my current code:</p>
  
  <pre><code>&lt;head&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;script&gt;
    var settings = {
       url: "https://harmelin.okta.com/api/v1/users/me",
      type: 'GET',
      dataType: 'json',
      contentType: 'application/json',
      xhrFields: {
          withCredentials: true
      },
      success: function (data) {
         // alert(JSON.stringify(data));
      },
      error: function(err){
        //  alert(JSON.stringify(err));
      }
     }
  
     jQuery.ajax(settings).done(function (success)  {
       console.log(success);
   var raw = success.profile.login;
   var email = raw.toLowerCase();
   var $login = email.replace(/@[^@]+$/, '');
  jQuery("#write-data").append($login);
  
  });
  &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
  &lt;?php
  
  // Tableau-provided functions for doing trusted authentication
  require_once 'tableau_trusted.php';
  
  ?&gt;
  
  &lt;div id="write-data"&gt;&lt;/div&gt;
  &lt;?php
  $user = 'jfedorowicz';
  $server = 'dashboard1.harmelin.com';
  $view = 'JoesPlayground/views/PTOStuff/Dashboard1?LCUsername=';
  $theLogin = $login;
  
  echo '&lt;iframe src="';
  echo get_trusted_url( $user,$server,$view$theLogin );
  echo '" width="400" height="400"&gt; &lt;/iframe&gt;';
  ?&gt;
  
  &lt;/body&gt;
  </code></pre>
  
  <p>Two problems: </p>
  
  <p>1) What I am looking to do is pass $login (javascript variable) into $view. I 100% know that I did not do this right, but I cannot test because problem two. </p>
  
  <p>2) I'm returning a 500 error: "Failed to load resource: the server responded with a status of 500 (Internal Server Error)" which I assume is a Tableau error but I cannot figure it out.</p>
  
  <p>Any ideas? Thanks.</p>