Now the post and get functions work with changes done with the api.
This commit is contained in:
@@ -15,28 +15,12 @@ $(document).ready(function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
function objectifyForm(formArray) {//serialize data function
|
|
||||||
var returnArray = {};
|
|
||||||
for (var i = 0; i < formArray.length; i++){
|
|
||||||
returnArray[formArray[i]['name']] = formArray[i]['value'];
|
|
||||||
}
|
|
||||||
return returnArray;
|
|
||||||
}
|
|
||||||
|
|
||||||
// this is the id of the form
|
// this is the id of the form
|
||||||
$("#searchForm").submit(function(e) {
|
$("#searchForm").submit(function(e) {
|
||||||
var formJsonObj = objectifyForm($("#searchForm").serializeArray());
|
var url = env_variables.url + 'verify/' + getURLId();
|
||||||
|
|
||||||
formJsonObj['verified'] = 1;
|
|
||||||
formJsonObj['id'] = getURLId();
|
|
||||||
console.log(formJsonObj);
|
|
||||||
|
|
||||||
var url = env_variables.url;
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
dataType: 'json',
|
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: JSON.stringify(formJsonObj),
|
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
Materialize.toast('Verification successfully sent!', 4000);
|
Materialize.toast('Verification successfully sent!', 4000);
|
||||||
},
|
},
|
||||||
@@ -58,21 +42,20 @@ function foo(id) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function getShow() {
|
function getShow() {
|
||||||
var url = env_variables.url + '?id=' + getURLId();
|
var url = env_variables.url + getURLId();
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: url,
|
url: url,
|
||||||
dataType: "json",
|
dataType: "json",
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
var episode = data['episode'];
|
$('#parent').val(data['parent']);
|
||||||
$('#parent').val(episode['parent']);
|
$('#name').val(data['name']);
|
||||||
$('#name').val(episode['name']);
|
$('#season').val(data['season']);
|
||||||
$('#season').val(episode['season']);
|
$('#episode').val(data['episode']);
|
||||||
$('#episode').val(episode['episode']);
|
$('#video_files').val(data['video_files']);
|
||||||
$('#video_files').val(episode['video_files']);
|
$('#subtitles').val(data['subtitles']);
|
||||||
$('#subtitles').val(episode['subtitles']);
|
$('#trash').val(data['trash']);
|
||||||
$('#trash').val(episode['trash']);
|
|
||||||
|
|
||||||
console.log(episode);
|
console.log(data);
|
||||||
},
|
},
|
||||||
error: function() {
|
error: function() {
|
||||||
console.log('erorr');
|
console.log('erorr');
|
||||||
|
|||||||
Reference in New Issue
Block a user