samedi 23 juillet 2016

Send form elements and array through $.ajax()

I need to pass through $.ajax() method some form elements and an array too. How can i send serialize and array by ajax?

my code bellow:

function loadgraficosajax(){
		var arr = ['331234','142323','327767'];
  
    	var data = $('#p-form').serialize;
  
        $.ajax({
            type: "POST",
            url: "/page/show",
            data: data,
            dataType : 'html',
            success: function (msg) {
                $(document).ajaxComplete(function (event, request, settings) {
                    $('.has-error').removeClass('has-error');

                    $(document).off('ajaxComplete').off('ajaxSend');
                    $('#addajax').html(msg);
                 });
            }
        });
	}

Aucun commentaire:

Enregistrer un commentaire