Java, Ajax to php

I know there is a disconnect between my Java and PHP, not being a programmer, I am sure I am missing something. 

the user.js looks like this:

function ExecuteScript(strId)
{
  switch (strId)
  {
      case "5xNs6o4ljs0":
        Script1();
        break;
  }
}

function Script1()
{
  // get Storyline player
var p = GetPlayer();

// get course title
var title = p.GetVar("varCourseTitle");

// get course result
var resultstatus = p.GetVar("varResultsStatus");

//display value on screen - U S E   T O   D E B U G 
alert("Course title: " + title);
alert("Result-Status to be passed: " + resultstatus);


$.post( "myPHP.php", { myQuizTitle:varCourseTitle, myPass:varResultsStatus}  );

alert("You are here");
}

In Function Script(1) is triggered on the results slide, I know the code works thought the first two alerts so I know the variables are exporting just fine.

Out in the folder where I published I put the myPHP.php file, very simple.

<?php

    $quiztitle = $POST['myQuizTitle'];
    $pass = $POST['myPass'];

    $file = fopen("test.txt","w");
    echo fwrite($file,"Hello World. Testing!");
    ($file);
?>

I know that this works, as I dummied it up and called it from a web page.  So the question I think is how do I create a call to jquery in side my user.js to call an ajax post event to make use of my PHP. 

Cheers

harry

3 Replies
harry jacobs

I tried but could not figure out how to do that, my understanding is that you build the call to jquery dynamically but I could not figure it out.  I tried using this web site, but I could not make sense of it

http://stackoverflow.com/questions/950087/how-to-include-a-javascript-file-in-another-javascript-file

I am not an advanced coder so I have never had to do this type of Cross call from Java to php before. 

If you know how to load jquery into the user.js it would be very handy.

Harry