?
Solved

1 popup jquery

Posted on 2015-01-09
4
Medium Priority
?
81 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Introduction Knockoutjs (Knockout) is a JavaScript framework (Model View ViewModel or MVVM framework).   The main ideology behind Knockout is to control from JavaScript how a page looks whilst creating an engaging user experience in the least …
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)
Suggested Courses

800 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