1

変数を ajax に渡す際に問題が発生しています。

これは動作します: url: 'testing.php?id=1',

これは機能しません: url: 'testing.php?id=theid',

動作する完全なコードは次のとおりです。

function myfunc(theid) {
    $.ajax({
        url: 'testing.php?user_id=1',
        success: function() {
            alert('this worked' + venueid);
        }
    });
}

そして、このコードは変数値を渡しません:

function myfunc(theid) {
    $.ajax({
        url: 'testing.php?user_id=theid',
        success: function() {
            alert('this worked' + venueid);
        }
    });
}

これは構文の問題ですか? 私はここで間違っていますか?

4

1 に答える 1

3
function myfunc(theid) {
$.ajax({
   url: 'testing.php?user_id='+ theid,
   success: function(){
   alert('this worked' + venueid);
                    }
});
}
于 2013-06-03T11:09:39.720 に答える