Welcome Guest, Not a member yet? Register   Sign In
Ajax form + CSRF results in a failing request
#2

[eluser]apodner[/eluser]
I could be wrong, but your form_data does not appear to contain the csrf token as a element, and it is therefore not going into the POST when your ajax call is made to the carrell/add script.

Try adding the token:

Code:
var form_data = {
     id: $('input#id').val(),
     tipo: $('input#tipo').val(),
     prezzo: $('input#prezzo').val(),
     inserzionista: $('input#inserzionista').val(),
     codice_sconto: $('input#codice_sconto').val(),
     csrf_test_name: $('input#csrf_test_name').val()
    };

I think this would work too and would push all form elements into POST at once:

Code:
var form_data = $("#addcart").serialize()

hope this gets you heading in the right direction


Messages In This Thread
Ajax form + CSRF results in a failing request - by El Forum - 11-27-2012, 05:26 AM
Ajax form + CSRF results in a failing request - by El Forum - 11-27-2012, 09:32 PM
Ajax form + CSRF results in a failing request - by El Forum - 11-28-2012, 02:02 AM
Ajax form + CSRF results in a failing request - by El Forum - 11-28-2012, 07:28 AM



Theme © iAndrew 2016 - Forum software by © MyBB