Solved

websphere portal ajax call using(from) Jquery datatable issue

Posted on 2013-01-16
2
972 Views
Last Modified: 2013-01-16
Hello gurus,
I am new to portals, AJAX and JQuery. If my teminalogy is not correct, please forgive me.
I am making AJAX call to server from JQuery datatable. On the server(portal) side, this is being served in serveResource() method.
I am pushing data in aoData in fnServerParams. When i am sending more data (more than 2000 charactes) i am getting GET 500 Internal Server Error.  This call is working fine with less data.

I think we have some 2K size limitaion in GET method. Can we switch to POST method ? If so what changes we need to do on AJAX call and portal side ? If using POST is not good solution please point me right direction ?


		function initDisplayTable(){
		    oTable = $('#displayData').dataTable( {
				"aLengthMenu": [[25, 50, 100, 200], [25, 50, 100, 200]],
				"bFilter": false,
				"iDisplayLength": 25,
			    "bProcessing": true,
			    "bStateSave": true,
			    "bServerSide": true,
			    "bAutoWidth": false,
			    "bRetrieve": true,
			    "sAjaxSource": document.getElementById('hdnGenResourceURL').value,
			    "aoColumns": [ 
					{"sName": "id", "sTitle": "", "bSortable": "true"},
					{"sName": "refID", "sTitle": "Corr ID/SR ID/Doc ID", "bSortable": "true", "sType":"numeric"},
					{"sName": "numOfInvoices", "sTitle": "# of Invoices", "bSortable": "true"},
					{"sName": "dateReceived", "sTitle": "Date Received", "sType" : "usdate" , "bSortable": "true"},
					{"sName": "respDueDate", "sTitle": "Response Due Date", "bSortable": "true"},
					{"sName": "modeOfReceipt", "sTitle": "Mode of Receipt", "bSortable": "true"},
					{"sName": "dispWorker", "sTitle": "Dispute Worker Assigned", "bSortable": "true"},
					{"sName": "dispWorkerRacf", "sTitle": "", "bSearchable": false, "bVisible": false},
					{"sName": "InitialState", "sTitle": "", "bSearchable": false, "bVisible": false},
					{"sName": "BillingAuthority", "sTitle": "", "bSearchable": false, "bVisible": false},
					{"sName": "CorrId", "sTitle": "", "bSearchable": false, "bVisible": false},
					{"sName": "ProcessId", "sTitle": "", "bSearchable": false, "bVisible": false}
					],
				"sPaginationType": "full_numbers",
				"aaSorting": [[3,'asc']],
				"oLanguage": {
			        "sLengthMenu": "Page length: _MENU_",
			        "sSearch": "Filter:",
			        "sZeroRecords": "No records found"
			     },
				"fnServerData": function ( sSource, aoData, fnCallback){
					
			            $.ajax( {"dataType": 'json',
			                 "type": "GET", 
			                 "url": sSource,
			                 "data": aoData,
			                 "success": function(result){

			                 		errorArray = result['serverResponse'];
									var len = errorArray[2];
									var isError = errorArray[0];
									var msg = errorArray[1];
									if(len >= 1){
										$('#repopField').hide();
										$('#QFieldSet').show('slow');
										if(isError == true || isError == 'true'){
											showQMsgBox('error', msg);
										}
										if(isError == false || isError == 'false'){
											showQMsgBox('success',msg);			
										}								
									}else{
										if(varBtnFlag == 'search'){
											var msg = 'no data available, please click re-populate button ';
											showQMsgBox('warning',msg);
											$('#QFieldSet').hide();
											$('#repopField').show();
										}else{
											// on startup - do nothing
										}
									}
									resetBtnFlag();
			                 		fnCallback(result);
			                 	}
			                 } );
		         	},			     
		        "fnServerParams": function ( aoData ) {
		        	aoData.push( { "name": "fromID", "value": "ajaxDataTables" } );
		        	if(varBtnFlag == 'search'){
		        		var searchBy = $('#qSearchBy :selected').text();
		        		var searchText = $('#qsearchTXT').val();
		        		aoData.push( { "name": "callTypeFrom", "value": "qSearch" } );
		        		aoData.push( { "name": "searchBy", "value": searchBy } );
		        		aoData.push( { "name": "searchText", "value": searchText } );
		        	}else if(varBtnFlag == 'getNext'){
		        		aoData.push( { "name": "callTypeFrom", "value": "qGetNext" } );
		        	}else if(varBtnFlag == 'reAssign'){
		        		//var isDeptSel = validateAssign();
		           		//if(isDeptSel == true){
							var allOtherVals = fetchQVals();
							var allQVals = JSON.stringify(qValsMap);	
		        			aoData.push( { "name": "callTypeFrom", "value": "qReAssign" } );
		        			aoData.push( { "name": "allOtherVals", "value": allOtherVals } );
		        			aoData.push( { "name": "qData", "value": allQVals } );
		        		//}	
		        	}
			    }		    
		    });
        }

Open in new window

0
Comment
Question by:kcmovies
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 500 total points
ID: 38784660
line 36 I see : "type": "GET",
so change it to : "type": "POST",

...and be sure to handle POST instead on server side
0
 

Author Comment

by:kcmovies
ID: 38784914
Its worked. Thank you.
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
AJAX Wordpress Not Reading Variable 2 59
import as existing maven project 3 42
Difference between Nuget Package and using Bower/Node.Js/Gulp 2 15
GitHub 1 11
Introduction A frequently asked question goes something like this:  "I am running a long process in the background and I want to alert my client when the process finishes.  How can I send a message to the browser?"  Unfortunately, the short answer …
Introduction Chart.js, used properly, can visually add a difference to your charting applications. It engages your visitors and allows them to interact with data they otherwise wouldn't be able to without expensive and complicated systems. For this…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question