바닐라
function action1() {
var xhr = new XMLHttpRequest();
xhr.open('POST', 'update_forex_first.php', true);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
}
};
xhr.send();
}
function action2() {
var xhr = new XMLHttpRequest();
xhr.open('POST', 'update_forex.php', true);
xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
}
};
xhr.send();
}
AJAX
function action1() {
$.ajax({
url: 'update_forex_first.php',
type: 'POST',
success: function(response) {
},
error: function(xhr, status, error) {
}
});
}
function action2() {
$.ajax({
url: 'update_forex.php',
type: 'POST',
success: function(response) {
},
error: function(xhr, status, error) {
}
});
}
AJAX-코드추가
function update_forex_action1() {
var form = document.fx_insert;
var data = new FormData(form);
$.ajax({
url: 'update_forex_first.php',
type: 'POST',
data: data,
processData: false,
contentType: false,
success: function(response) {
alert(response);
},
error: function(xhr, status, error) {
alert("요청실패");
}
});
}
function update_forex_action2() {
var form = document.fx_insert;
var data = new FormData(form);
$.ajax({
url: 'update_forex.php',
type: 'POST',
data: data,
processData: false,
contentType: false,
success: function(response) {
alert(response);
},
error: function(xhr, status, error) {
alert("요청실패");
}
});
}