?
Solved

websphere portal ajax call using(from) Jquery datatable issue

Posted on 2013-01-16
2
Medium Priority
?
978 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 82

Accepted Solution

by:
leakim971 earned 2000 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

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Question has a verified solution.

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

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…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
This tutorial covers a practical example of lazy loading technique and early loading technique in a Singleton Design Pattern.
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…
Suggested Courses

765 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