jQWidgets Forums

jQuery UI Widgets Forums Grid Send form data to server

This topic contains 2 replies, has 2 voices, and was last updated by  Martin 6 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • Send form data to server #102884

    safraga
    Participant

    Hello,
    I would like to send external form to the server to receive the source data for JQXGrid.

    
    var formDatas = $("#Option").serialize();
    var source =
    {
    	datatype: "json",
    	type: 'POST',
    	url: 'api/getliste.php',
    	data: formDatas,
    	datafields:
    	[
    		{ name: 'mbrNom', type: 'string'},
    		{ name: 'mbrPrenom', type: 'string'},
    	],
    	cache: false,
    	root: 'Rows',
    };

    But the extra datas was not send to the server.
    There is a way to do that?

    Thank you for help,
    Best regards

    Send form data to server #102896

    safraga
    Participant

    Hello,
    This post is resolved, I used this code to retriew formdatas…

    var form = $("#Option");
    	//Parser form datas
    	var formDatas = {};
    	var formArray = form.serializeArray();
    	$.each(formArray, function () {
    		if (formDatas[this.name]) {
    			if (!formDatas[this.name].push) {
    				formDatas[this.name] = [formDatas[this.name]];
    			}
    			formDatas[this.name].push(this.value || '');
    		} else {
    			formDatas[this.name] = this.value || '';
    		}
    	});
    	// prepare the data
    	var source =
    	{
    		datatype: 'json',
    		url: 'api/getliste.php',
    		type: 'POST',
    		data: {
    			searchString: formDatas['searchString'],
    			search_by: formDatas['search_by'],
    			'searchCase[]': formDatas['searchCase[]'],
    			afficheLimit: formDatas['afficheLimit'],
    			afficheLimitPages: formDatas['afficheLimitPages']
    		},
    		datafields:
    		[
    			{ name: 'mbrNom', type: 'string'},
    			{ name: 'mbrPrenom', type: 'string'},
    		],
    		cache: false,
    		root: 'Rows'
    	};

    Best regards

    Send form data to server #102899

    Martin
    Participant

    Hello safraga,

    Thank you for the update!

    Best Regards,
    Martin

    jQWidgets Team
    http://www.jqwidgets.com/

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.