Solved

1 popup jquery

Posted on 2015-01-09
4
70 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
Comment Utility
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 42

Expert Comment

by:Rob Jurd, EE MVE
Comment Utility
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
Comment Utility
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
Comment Utility
I dont need the question answered
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
jquery, html5 UI 1 46
Image decoding from Camera 3 42
Change properties of a dialog box 1 19
Cordova Camera plugin fails 2 5
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to create an extensible mechanism for linked drop downs.
The viewer will learn how to dynamically set the form action using jQuery.
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…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now