Ajax used basic 2 send multiple value pass validation send onsubit empty input box

ajax 0 Comments

Ajax used basic 2 send multiple value pass validation send onsubit empty input box in case show result on click and emty input box Show result value detail same file in html php used ajax

in case show result on click and emty input box

Show result value detail same file in html php used ajax

 

<script type = "text/javascript" >
//	Jquery synatx
$(document).ready(function(){
<!------show to content form---------->
  function showComment(){  
  //  var phonenocomment = $("#country_name").val();  
   var phonenocomment = $("#phonenocomment").val();   
                      $.ajax({
                        type:"post",
                        url:"actioncomment.php",
						data:"phonenocomment="+phonenocomment+"&action=showcomment",
						
                      // data:"action=showcomment",
                        success:function(data){
                             $("#dismsgcomment").html(data);
                        }
                      });
                    }					 
                    showComment();  // show comment commen phone no
<!---------------->
<!------add content---------->
$("#subcomment").click(function() {  
 var msgcommentlist = $("#msgcommentlist").val();
 var sirstaff = $("#sirstaff").val();
 var phonenocomment = $("#phonenocomment").val();
 var phonelistcomment = $("#phonelistcommenttop").val(); 
 var calendar_datePicker1 = $("#calendar_datePicker1").val(); 
 var calendar_datePicker = $("#calendar_datePicker").val();     
  var topnamecomment = $("#inputaddname1").val();   
   //alert(topnamecomment);    
   var topcourscomment = $("#inputcourese1").val(); 
    var topcitycommnt = $("#inputaddcity1").val(); 
	var statusstatusst = $("#statussttop:checked").val();
	
	var callstatusst = $("#callstatusst:checked").val();
	var courseselect = $("#courseselect").val();
	
	 var toponlineq = $("#toponlineq").val(); 
	   var topqualicommnt = $("#inputquali1").val(); 
	   var statusalluponrp = $("#statusalluponrp").val();	

	//var statusstatusst = $("#statusstatusst").val();  
/*$.post("action.php",{name:name,email:emailid,phoneno:phoneno},function(data){
$("#result").html(data);
});*/    //&topnamecomment="+topnamecomment+"&topcourscomment="+topcourscomment+"&topcitycommnt="+topcitycommnt+"        

/* if(msgcommentlist != '')*/  
  if(phonenocomment != '') 
           { 
$.ajax({
url:'actioncomment.php',
data:"msgcommentlist="+msgcommentlist+"&callstatusst="+callstatusst+"&courseselect="+courseselect+"&topnamecomment="+topnamecomment+"&topqualicommnt="+topqualicommnt+"&toponlineq="+toponlineq+"&topcourscomment="+topcourscomment+"&topcitycommnt="+topcitycommnt+"&statusstatusst="+statusstatusst+"&sirstaff="+sirstaff+"&phonenocomment="+phonenocomment+"&phonelistcomment="+phonelistcomment+"&calendar_datePicker1="+calendar_datePicker1+"&calendar_datePicker="+calendar_datePicker+"&statusalluponrp="+statusalluponrp+"&action=addcomment",  
//data:{name:name,email:emailid,phoneno:phoneno,action:addcomment},
type:'POST',
success:function(data){
$("#result").html(data);
showComment();

}

});

 }  
           else  
           {  
                $('#result').html('');                 
           }  
 <!------ Condition apply on desction empty-------->
 document.getElementById("msgcommentlist").value = "";
});
});
</script>

 

Html File on click submit

 

<input type="button" value="Submit & Send SMS " name="subcomment" id="subcomment" class="btn btn-primary" style="width:35%; text-align:center"/>

in case show result according to on click submit

apply validation

 

<?php
include('config.php');
include("sessionset.php"); 
$sirstaff = $_POST['sirstaff'];
$msgcommentlist = $_POST['msgcommentlist'];
$phonenocomment = $_POST['phonenocomment'];
$phonelistcomment = $_POST['phonelistcomment'];
$calendar_datePicker1 = $_POST['calendar_datePicker1'];
$calendar_datePicker = $_POST['calendar_datePicker'];
 if (empty($calendar_datePicker)){
 $calendar_datePicker = date("Y-m-d");
 }
$action=$_POST["action"];
$topnamecomment=$_POST["topnamecomment"];
$topcourscomment=$_POST["topcourscomment"];
$topcitycommnt=$_POST["topcitycommnt"];
$statusst=$_POST["statusstatusst"];   

$toponlineq=$_POST["toponlineq"];
$topqualicommnt=$_POST["topqualicommnt"];
$addcl = $_POST['statusalluponrp'];

$callstatusst = $_POST['callstatusst'];
$courseselectex = $_POST['courseselect'];

//$salarymin=$_POST["salary"];

			$courseselectidc = explode(",", $courseselectex);

		 $couridselectid = $courseselectidc[0];

		 $couridselectname = $courseselectidc[1];

date_default_timezone_set('Asia/Kolkata');
           $time =  date('h:i:s a');
			// $time =  date("h:i:s a"); 

 if($action=="showcomment"){ ?>  

 <?php
	if(!empty($phonenocomment)) {     // if empety first condition check
	$querya=mysql_query("Select * from tableWHERE mobile = '$phonenocomment'");
    $rowcount =mysql_num_rows($querya);
	if($rowcount > 0){		  
	?>	
	<?php
		$querysh=mysql_query("Select * from table WHERE mobile = '$phonenocomment' order by adminno desc");
		$rowcountshow = mysql_fetch_array($querysh);			  
		?>	   							
																								
 <?php 
  } 
  
  } 
  
    else if($action=="addcomment"){ 	
	
		
	if($msgcommentlist != ''){ 
	     $addno =  mysql_query("insert into table(staffname,msgcomment,phoneno,calladminid,calldateup,callidnext,name,coursetop,cityname,qualifi,onlinestatus,statusst,statusall,callstatus,selectcorseid,selectcourse,time) values ('$sirstaff','$msgcommentlist','$phonenocomment','$phonelistcomment','$calendar_datePicker1','$calendar_datePicker','$topnamecomment','$topcourscomment','$topcitycommnt','$topqualicommnt','$toponlineq','$statusst','$addcl','$callstatusst','$couridselectid','$couridselectname','$time')");
	   
	   
	   $couridselectid = $courseselectidc[0];

		 $couridselectname = $courseselectidc[1];
	   
	
	echo "* Followup Completed *";

	 }else{
	  echo "Followup Completed";
	 }
	
	}
  
 
?>