gregdevs
gregdevs

Reputation: 713

ie9 - FormData undefined - javascript

I'am submitting some data via ajax and trying to get a grasp on what's the best method for restructuring my code to work on ie9. Of course, it's submitting fine on all other browsers.

I'm using angularJS for the frontend so, the submit function is triggered like so

JS

//angular snippet
 $scope.submitBrackets = function($event) {
     submitVotes(roundNumber, submissionArray.toString());
 }

//submit function

function submitVotes(roundNum, competitorsIDs) {
    var formData = new FormData();
    formData.append("roundNum", roundNum);
    formData.append("competitorsIDs", competitorsIDs);

    $.ajax({
     url : "http://myUrl.com/form/formstuff/apiStuff",
     type: "GET",
     //async:false,
     //Ajax events
     beforeSend: function(){},
     dataType: "json",
     isLocal: false,
     // Form data
     data: "r="+roundNum+"&ids="+competitorsIDs,
     //Options to tell JQuery not to process data or worry about content-type
     cache: false,
     contentType: false,
     processData: false
   });


 }

Thanks for any input, suggestions.

Upvotes: 1

Views: 2766

Answers (1)

JLRishe
JLRishe

Reputation: 101730

It doesn't look like you're even using the formData in your code. You're just creating a formData variable and abandoning it.

The data property is all you need. You can delete the FormData part:

data: {
    r: roundNum,
    ids: competitorsIDs
},

Upvotes: 1

Related Questions