Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top