Skip to content

Commit

Permalink
added contentType: application/json to the interface to fix the colla…
Browse files Browse the repository at this point in the history
…psing bug #3
  • Loading branch information
sdellis committed Apr 9, 2015
1 parent e5ab4a3 commit 02ed5b4
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions public/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,9 @@ $( "#formEditManifest" ).submit(function( event ) {
$.ajax(
{
url : formURL,
contentType: "application/json",
method: "PUT",
data : payload,
data : postDataJSON,
success:function(data, textStatus, jqXHR)
{
refreshManifests('alert-success','<h2>Manifest created:</h2><pre>' + postDataJSON + '</pre>');
Expand All @@ -116,7 +117,9 @@ $( "#formEditManifest" ).submit(function( event ) {
});

$( "#formAddManifest" ).submit(function( event ) {
console.log("formdata: " + $(this));
event.preventDefault();
event.stopPropagation();

var postData = $(this).serializeArray();
var payload = JSON.parse(postData[0].value);
var formURL = $(this).attr("action");
Expand All @@ -126,8 +129,9 @@ $( "#formAddManifest" ).submit(function( event ) {
$.ajax(
{
url : formURL,
contentType: "application/json",
method: "POST",
data : payload,
data : postDataJSON,
success:function(data, textStatus, jqXHR)
{
refreshManifests('alert-success','<h2>Manifest created:</h2><pre>' + postDataJSON + '</pre>');
Expand All @@ -138,9 +142,6 @@ $( "#formAddManifest" ).submit(function( event ) {
}
});

event.preventDefault();
event.stopPropagation();

});

// This code handles the expandable textarea
Expand Down

0 comments on commit 02ed5b4

Please sign in to comment.