L
L
Lev K2016-05-06 19:50:03
JavaScript
Lev K, 2016-05-06 19:50:03

How to send form.serialize and other data in yii with ajax?

I need to send more data along with the form, an array, how to do it?

var mas = [5],
$.ajax({
            type: 'POST',
            data: form.serialize()+'&mas', // здесь мне нужно добавить массив правильно ли я сделал ? 
            dataType: 'json',
            success: function (result) {
                alert('Ok');
            },
            error: function () {
                alert('Error');
            }
        });

Models to sign up as before?
How to access mas ?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Ukolov, 2016-05-06
@alexey-m-ukolov

form.serialize()+'&mas', // I need to add an array here, did I do it right?
No, you did wrong. All you have done is add a get parameter named mas with no value. You need to loop through the correct get parameter. How it should look like I showed you in the previous question.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question