Link to home
Start Free TrialLog in
Avatar of traport
traport

asked on

Add a "Loading Modal" to a search

I can't figure out how to show my "loading" modal within this block of code so that any time the form is submitting the loading will come up.

Where would this:

$("#searchLoader").show();

Open in new window


go in the code below so that everytime the search is submitted the searchLoader appears in modal.

var bindSearchSubmit = function() {
	$('form[name="searchform"]').submit(function(e){
		e.preventDefault();
                    var frmData = $(this).serializeJSON(),
			       postdata = {
				method: "getBindersBySearchCriteria",
				returnFormat:"json",
				DSN: cfrequest.dsn,
				InstanceId: cfrequest.instanceId,
				xJLLISUserId: cfrequest.xJLLISUserId,
				oFormData: $.extend({},frmData,{countonly:1}),
				PageSize: 10,
				cachebuster: new Date().toString()
			};
		postdata.oFormData = $.toJSON(postdata.oFormData);

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of Gary
Gary
Flag of Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of traport
traport

ASKER

Thank you so much. As it turns out I listed the wrong submit block... It's after the form "linktoSelectForm" is submitted. Thank you for your help. I'm sorry.

var searchLinkToList = function(idlist){
		var idlist = (typeof idlist === 'undefinded' || idlist === "") ? cfrequest.instanceId : idlist,
			$modal = $('.linkToOrgSearchListModal'),
			$form = $("#linktoSelectForm"),
			tabname = $("input[name=tabname]", $form).val(),
			requestData = {
				linkentitytype: $("input[name=linkentitytype]", $form).val(),
				entityid: $("input[name=entityid]", $form).val(),
				entitytype: $("input[name=entitytype]", $form).val(),
				callback: $("input[name=callback]", $form).val(),
				copsectionid: $("input[name=copsectionid]", $form).val(),
				copsectionexpanded: $("input[name=copsectionexpanded]", $form).val(),
				tabname: tabname,
				tieridlist: idlist
			};

Open in new window

Avatar of traport

ASKER

I posted the wrong block but based on response was able to figure out placement in new block. Thanks so much.