Solved

1 popup jquery

Posted on 2015-01-09
4
79 Views
Last Modified: 2015-01-19
Hi,

I am trying to change this massive code to have just 1 popup ONLY of 'availability doesnt match do you want to continue'  ok or cancel as the options. The code is part of a html code which just calls this code as part of a cakephp program.

I cant remove the extra dialogs after this notification.
Also the notification if the availability does match I want it to continue.
I really want to shorten this code to a few lines only but i cant .


  var form = $('#LessonAddIndividualstudentForm');
						$.ajax( {
						  type: "POST",
						  url: siteurl+'lessons/check_student_tutor_avalability',
						  data: form.serialize(),
						  success: function( response ) {
                                                      		
						      LessonScheduleRec=document.getElementById('LessonScheduleRec').checked;
						      LessonScheduleMonthly=document.getElementById('LessonScheduleMonthly').checked;
						      LessonScheduleYearly=document.getElementById('LessonScheduleYearly').checked;
								
                                                      jQuery('#tutor_email_noti').val('0');
                                                      jQuery('#LessonAddIndividualstudentForm').submit();
						      jQuery( this ).dialog( "close" );
                                                      
                                                     /* 
							 if(response==1){
							 
							      // if(confirm("availability is matched Do you want to continue?")){							   							         
											
											event.preventDefault();
											  jQuery( "#notification_msg" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:150,
											  width:'auto',
											  title: "SMS Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
										{
									 text: "Ok",
									"class": 'OKButtonClass btn btn-large btn-primary',
									click: function() {

										jQuery('#message').val('1');
										jQuery( this ).dialog( "close" );
										/////////===========
										
									LessonScheduleRec=document.getElementById('LessonScheduleRec').checked;
									LessonScheduleMonthly=document.getElementById('LessonScheduleMonthly').checked;
									LessonScheduleYearly=document.getElementById('LessonScheduleYearly').checked;
													    
							if(LessonScheduleRec==true){										
										
									      jQuery( "#notification_msg_msg" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "SMS Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																var ms =  jQuery('#noti_msg_schedual').val();
																jQuery('#message_text').val(ms);
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
												  jQuery( this ).dialog( "close" );
												}
											  })
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#message').val('0');
																jQuery('#message_text').val(' ');
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:250,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
													jQuery('#tutor_email_noti').val('0');
												  jQuery( this ).dialog( "close" );
												  
												}
											  })
															}
														}
													],
													Cancel: function() {
														jQuery('#tutor_email_noti').val('0');
													  jQuery( this ).dialog( "close" );
													}
											  })
											  
											  
										
									}else if(LessonScheduleMonthly==true){ 
										
										jQuery( "#notification_msg_msg_monthely" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "SMS Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																var ms =  jQuery('#noti_msg_monthely').val();
																jQuery('#message_text').val(ms);
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
												  jQuery( this ).dialog( "close" );
												}
											  })
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#message').val('0');
																jQuery('#message_text').val(' ');
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:250,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
													jQuery('#tutor_email_noti').val('0');
												  jQuery( this ).dialog( "close" );
												  
												}
											  })
															}
														}
													],
													Cancel: function() {
														jQuery('#tutor_email_noti').val('0');
													  jQuery( this ).dialog( "close" );
													}
											  })
											  
											  
										}else if(LessonScheduleYearly==true){
										
										         
												 
											  jQuery( "#notification_msg_msg_yearly" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "SMS Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																var ms =  jQuery('#noti_msg_yearly').val();
																jQuery('#message_text').val(ms);
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
												  jQuery( this ).dialog( "close" );
												}
											  })
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#message').val('0');
																jQuery('#message_text').val(' ');
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:250,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
													jQuery('#tutor_email_noti').val('0');
												  jQuery( this ).dialog( "close" );
												  
												}
											  })
															}
														}
													],
													Cancel: function() {
														jQuery('#tutor_email_noti').val('0');
													  jQuery( this ).dialog( "close" );
													}
											  })								
										
										
										}else{
										
										       jQuery( "#notification_msg_msg_oneoff" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "SMS Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																var ms =  jQuery('#noti_msg_oneoff').val();
																jQuery('#message_text').val(ms);
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
												  jQuery( this ).dialog( "close" );
												}
											  })
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#message').val('0');
																jQuery('#message_text').val(' ');
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:250,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
													jQuery('#tutor_email_noti').val('0');
												  jQuery( this ).dialog( "close" );
												  
												}
											  })
															}
														}
													],
													Cancel: function() {
														jQuery('#tutor_email_noti').val('0');
													  jQuery( this ).dialog( "close" );
													}
											  })
										
										
										
										
										}	  
										
														//////////////=========
													}
												},
												{
													text: "Cancel",
													"class": 'cancelButtonClass btn btn-large btn-danger',
													click: function() {
														jQuery('#tutor_email_noti').val('0');
														jQuery('#message').val('0');
														jQuery('#message_text').val(' ');
														jQuery('#LessonAddIndividualstudentForm').submit();
														jQuery( this ).dialog( "close" );
													}
												}
											],
											Cancel: function() {
											  jQuery( this ).dialog( "close" );
											}
									  });
								//}else{
								
								   //  return false;
								
								//}  
						          
									  
						  }else{							   
							   
							   if(confirm("Availability Does Not Match Do you want to continue?")){
							          
												event.preventDefault();
								  jQuery( "#notification_msg" ).dialog({
								  resizable: false,
								  dialogClass: "notification_popup",
								  height:150,
								  width:'auto',
								  title: "SMS Notification",
								  closeText: "X",
								  modal: true,
								  buttons: [
					        {
						text: "Ok",
						"class": 'OKButtonClass btn btn-large btn-primary',
						click: function() {

							jQuery('#message').val('1');
							jQuery( this ).dialog( "close" );
							/////////===========
							
							    	LessonScheduleRec=document.getElementById('LessonScheduleRec').checked;
									LessonScheduleMonthly=document.getElementById('LessonScheduleMonthly').checked;
									LessonScheduleYearly=document.getElementById('LessonScheduleYearly').checked;
													    
							if(LessonScheduleRec==true){										
										
									      jQuery( "#notification_msg_msg" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "SMS Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																var ms =  jQuery('#noti_msg_schedual').val();
																jQuery('#message_text').val(ms);
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
												  jQuery( this ).dialog( "close" );
												}
											  })
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#message').val('0');
																jQuery('#message_text').val(' ');
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:250,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
													jQuery('#tutor_email_noti').val('0');
												  jQuery( this ).dialog( "close" );
												  
												}
											  })
															}
														}
													],
													Cancel: function() {
														jQuery('#tutor_email_noti').val('0');
													  jQuery( this ).dialog( "close" );
													}
											  })
											  
											  
										
									}else if(LessonScheduleMonthly==true){ 
										
										jQuery( "#notification_msg_msg_monthely" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "SMS Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																var ms =  jQuery('#noti_msg_monthely').val();
																jQuery('#message_text').val(ms);
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
												  jQuery( this ).dialog( "close" );
												}
											  })
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#message').val('0');
																jQuery('#message_text').val(' ');
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:250,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
													jQuery('#tutor_email_noti').val('0');
												  jQuery( this ).dialog( "close" );
												  
												}
											  })
															}
														}
													],
													Cancel: function() {
														jQuery('#tutor_email_noti').val('0');
													  jQuery( this ).dialog( "close" );
													}
											  })
											  
											  
										}else if(LessonScheduleYearly==true){
										
										         
												 
											  jQuery( "#notification_msg_msg_yearly" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "SMS Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																var ms =  jQuery('#noti_msg_yearly').val();
																jQuery('#message_text').val(ms);
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
												  jQuery( this ).dialog( "close" );
												}
											  })
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#message').val('0');
																jQuery('#message_text').val(' ');
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:250,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
													jQuery('#tutor_email_noti').val('0');
												  jQuery( this ).dialog( "close" );
												  
												}
											  })
															}
														}
													],
													Cancel: function() {
														jQuery('#tutor_email_noti').val('0');
													  jQuery( this ).dialog( "close" );
													}
											  })								
										
										
										}else{
										
										       jQuery( "#notification_msg_msg_oneoff" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "SMS Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																var ms =  jQuery('#noti_msg_oneoff').val();
																jQuery('#message_text').val(ms);
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:260,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
												  jQuery( this ).dialog( "close" );
												}
											  })
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#message').val('0');
																jQuery('#message_text').val(' ');
																jQuery( this ).dialog( "close" );
																jQuery( "#notification_tutor" ).dialog({
											  resizable: false,
											  dialogClass: "notification_popup",
											  height:250,
											  width:'auto',
											  title: "Email Notification",
											  closeText: "X",
											  modal: true,
											  buttons: [
														{
															text: "Ok",
															"class": 'OKButtonClass btn btn-large btn-primary',
															click: function() {
																
																	
																jQuery('#tutor_email_noti').val('1');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														},
														{
															text: "Cancel",
															"class": 'cancelButtonClass btn btn-large btn-danger',
															click: function() {
																jQuery('#tutor_email_noti').val('0');
																jQuery('#LessonAddIndividualstudentForm').submit();
																jQuery( this ).dialog( "close" );
															}
														}
													],
												Cancel: function() {
													jQuery('#tutor_email_noti').val('0');
												  jQuery( this ).dialog( "close" );
												  
												}
											  })
															}
														}
													],
													Cancel: function() {
														jQuery('#tutor_email_noti').val('0');
													  jQuery( this ).dialog( "close" );
													}
											  })
										
										
										
										
										}	
								  
								  
								  
							
											//////////////=========
										}
									},
									{
										text: "Cancel",
										"class": 'cancelButtonClass btn btn-large btn-danger',
										click: function() {
											jQuery('#tutor_email_noti').val('0');
											jQuery('#message').val('0');
											jQuery('#message_text').val(' ');
											jQuery('#LessonAddIndividualstudentForm').submit();
											jQuery( this ).dialog( "close" );
										}
									}
								],
								Cancel: function() {
								  jQuery( this ).dialog( "close" );
								}
						        });
											
									  
							   
							   }else{
							     
								 
							   //alert("Availability Does Not Match please check availability");
							     return false;
							   }
						    }
						   /// $('#tutoravaliablityresposnse').html(msg);
						  }
                                                  
                                                  
                                             
					  });		
		
		
		
		

Open in new window

0
Comment
Question by:jagguy
[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
  • 3
4 Comments
 

Author Comment

by:jagguy
ID: 40542973
This code is messy so I am trying to shorten it to this but it wont work as no error and the webpage doesnt continue to post to the cakephp controller.

 <a href="#" id="check_noti" class="btn btn-info btn-large">Save</a>
.....
jQuery(document).ready(function(){
    jQuery('#check_noti').click(function(event){
           siteurl='<?php echo $siteurl; ?>';

var form = $('#LessonAddIndividualstudentForm');
                        $.ajax( {
                          type: "POST",
                          url: siteurl+'lessons/check_student_tutor_avalability',
                          data: form.serialize(),
                          success: function( response ) {
                             jQuery('#tutor_email_noti').val('1');
                            jQuery('#LessonAddIndividualstudentForm').submit();
...

Open in new window

0
 
LVL 43

Expert Comment

by:Rob
ID: 40542985
I know it's obvious but I have to rule it out. Firstly can you navigate in your browser to

siteurl+'lessons/check_student_tutor_avalability

Is siteurl even needed? If you're on the same domain you shouldn't need it
0
 

Accepted Solution

by:
jagguy earned 0 total points
ID: 40550310
Yes I can do this.
What happened is that I got rid of all the jquery and used cakephp instead.
Jquery is always a bad solution for security reasons as it can be turned off.
0
 

Author Closing Comment

by:jagguy
ID: 40557297
I dont need the question answered
0

Featured Post

Get Actionable Data from Your Monitoring Solution

Your communication platform is only as good as the relevance of the information you send. Ensure your alerts get to the right people every time with actionable responses. Create escalation rules that ensure everyone follows the process and nothing is left to chance.

Question has a verified solution.

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

Requirements JQuery 1.6+ HTML CSS Introduction This article was inspired by an EE question (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28372511.html) on how to make a page show some balloons animate up a page…
OverviewThis article demonstrates a simple search form using AJAX. The purpose of the article is to demonstrate how to use the same code to render a page and javascript (JQuery) and AJAX to make subsequent calls to refine the results. The princip…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. 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.: (CODE)
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…

717 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