Solved

1 popup jquery

Posted on 2015-01-09
4
78 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Node.js 11 80
Different Javascript on iPhone than Win 10 desktop? 7 53
Secure registration PHP 7 40
Drag & Drop Error 5 30
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 If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
The viewer will learn how to dynamically set the form action using jQuery.
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)

732 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