문제

I have written the following jQuery code:

$('#Submitter').click(function(f) {

    x = $('#link').serialize();
    $('body').append(x);
    $.ajax({
        type:POST,
        url:"engine.php",
        data:x,
        success: function(i){
            console.log(i);
            $('#i').html(i);
        }
    });
});

Each time after clicking on the <input id="Submitter" type="button" value=Submit> element, Firefox's console displays the error: ReferenceError: POST is not defined.

Where is the issue and how to resolve this issue?

Thank you.

도움이 되었습니까?

해결책

replace your code like this :

$('#Submitter').click(function(f) {

    x = $('#link').serialize();
    $('body').append(x);
    $.ajax({
        type:'POST',
        url:"engine.php",
        data:x,
        success: function(i){
            console.log(i);
            $('#i').html(i);
        }
    });
});

POST needs to be enclosed with quotes

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top