Created
August 4, 2014 15:58
-
-
Save bryanboza/c8b65198ac3802e6a03b to your computer and use it in GitHub Desktop.
log
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> | |
<script type="text/javascript" > | |
$(document).ready(function() { | |
$("#webup").submit(function(e) { | |
e.preventDefault(); | |
var dataObj={ }; | |
if($('#title').val() != undefined && $('#title').val().length > 0){ | |
dataObj.title = $('#title').val(); | |
} | |
if($('#thisWork').val() != undefined && $('#thisWork').val().length > 0){ | |
dataObj.body = $('#thisWork').val(); | |
} | |
dataObj.stName="webPageContent"; | |
console.log(dataObj); | |
$.ajax({ | |
url: '/api/content/save/1', | |
type: 'PUT', | |
cache:false, | |
data: dataObj, | |
success: function(data,status,xhr) { | |
alert("works!"); | |
window.location="/"; | |
}, | |
error: function(data,status,xhr) { | |
alert("Uh Oh, your request failed. Please check your entries and try again"); | |
}, | |
}); | |
}); | |
}); | |
</script> | |
<form id="webup" name="webup" action="/api/content/save/1" > | |
<div class="form-group"> | |
<label for="firstName" class="required">Title</label> | |
<input type="text" class="form-control" id="title" name="title" value="my title"> | |
</div> | |
<div class="form-group"> | |
<label for="lastName" class="required">Last Name</label> | |
<textarea id="thisWork" name="thisWork" >Here is a text area | |
again</textarea> | |
</div> | |
<br> <br> | |
<div class="form-group"> | |
<input type="submit" value="Give 'er a go" /> | |
</div> | |
</form> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment