Is there a way to send variables to a form I have created?

  • ninman
    Asked on April 9, 2015 at 10:17 AM

    I have an eLearning site for our company and I want to track results. I have set up variables, but I am having difficulty sending those variables to the coordinating form that I have created on JotForm.

     

    Here are my variables:

    var player = GetPlayer();
    $.ajax({
          url: "http://form.jotform.us/form/50984047371156",
          type: "POST",
          data: {"q1_courseTitle" :player.GetVar("CourseTitle"),
                   "q3_resultsStatus" :player.GetVar("ResultsStatus"),
                   "q4_scorePctg" :player.GetVar("ScorePctg"),
                   "q5_passingPctg":player.GetVar("PassingPctg"),
                   "q6_scorePoints" :player.GetVar("ScorePoints"),
                   "q7_passingPoints":player.GetVar("PassingPoints")},
          success: function (data)
          {
             alert(data);
          }
    });

     

    I could embed the form into the course, but I would prefer to have the results sent over executed by javascript when they open the page. That way we can ensure that the results are accurate and they have not mistyped any information or purposefully submitted that they passed when they did not.

     

    Thank you in advance for any assistance.

  • Elton Support Team Lead
    Replied on April 9, 2015 at 12:11 PM

    Hi,

    Unfortunately, that's not going to work with Jotform. You have to use Jotforms API endpoint api.jotform.com in order to submit data to your form.

    Here's a guide for that: http://api.jotform.com/docs/#post-form-id-submissions

    However, if you only want to prepopulate data to your form through URL parameter, here's a guide: http://www.jotform.com/help/71-Prepopulating-the-fields-to-your-JotForm-via-URL-parameters

    Let us know if you need any further assistance.

    Best Regards!