Solved

1 popup jquery

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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jQuery Dialog Autoresize Bug 2 25
function parameter and using that as array 15 23
Json Schema 8 32
Ajax and PHP 9 29
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…
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)

839 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