LoginSignup
2
3

More than 5 years have passed since last update.

ajaxで戻り値が受け取れない。

Posted at

jquery-2.2.3.min.jsを使用しています。
締め処理を行っていたら、1分ごとにチェックを行うfunctionを実行させたいと思っています。
http://qiita.com/katsukii/items/bd64efcf4f070d77c028
より
function SimeConfirm() {
//締め処理区分を確認する。
return $.ajax({
url:"manual/gmanualini/",
type:'GET',
dataType:"text"
})
}
SimeConfirm().done(function(data) {
console.log(data); /A/
//日時更新をしていれば、チェックボックスのチェックを外す。
if(data=='true') {
$('input:checkbox').prop('checked',false);
}
})
.fail(function(data) {
alert(data);

});
var setTimer;
function Autoprocess() {
var value=SimeConfirm();
console.log(value); /B/
if (SimeConfirm()=='true') {
//日次更新済。
stopTimer();

}else{

    //日次更新していない。
    startTimer();           
}

}

//開始
function startTimer() {
setTimer=setInterval(function() {
SeikEndcheck();
} ,60000);
}

//ストップ
function stopTimer() {
clearInterval(setTimer);
}
Aの部分の console.log(data);では、"false"と表示されますが、
Bの部分の console.log(value);では、"Object {readyState: 1}"と表示されます。
"readyState: 1"を調べてみると、「sendメソッドでデータが送られていない。」とありました。
うまくreturnを受け取っていないように見えるのですが、
どうすればよろしいのでしょうか。
よろしくお願いします。

2
3
2

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
3