Jump to content

djbuddhi

Members
  • Posts

    153
  • Joined

  • Last visited

    Never

Posts posted by djbuddhi

  1. i want to execute a function with ajax ,that part is successfully working .at the same time i want to display some figures in a table in the main page .my question

    is how to execute the html table coding with the above calculation with the same time  in the main page with php/ajax

     

     

    any clue ?

  2. where to put the function in ajax file

     

    can mention the place where the function going 2 put

     

     

    //Browser Support Code

     

    var noOfSubmits = 0;

     

    function initForm()

    {

    noOfSubmits = 0;

     

    }

     

    function dome()

     

    {

    noOfSubmits = 0;

     

    }

     

     

    function clear_data(){

     

    document.getElementById("title").value=0;

    document.getElementById("surname").value="";

    document.getElementById("initials").value="";

    document.getElementById("name_d_inintials").value="";

    document.getElementById("nic_no").value="";

    document.getElementById("FrmDate").value="";

    document.getElementById("comp_usb_div").value="";

    document.getElementById("emp_no").value="";

    document.getElementById("add_1").value="";

    document.getElementById("add_2").value="";

    document.getElementById("town_city").value="";

    document.getElementById("province").value="";

     

     

     

    if (document.getElementById("chkagree").checked ){

            document.getElementById("chkagree").checked = false;

    document.getElementById('row11').style.display="none";                       

                            document.getElementById('row12').style.display="none";

                            document.getElementById('row13').style.display="none";

     

    }

     

    document.getElementById("mob_no").value="";

    document.getElementById("office_telno").value="";

    document.getElementById("res_tel_no").value="";

    document.getElementById("email_add").value="";

     

     

     

     

     

     

    }

     

     

    function ajaxFunction(){

    var ajaxRequest;  // The variable that makes Ajax possible!

     

    try{

    // Opera 8.0+, Firefox, Safari

    ajaxRequest = new XMLHttpRequest();

    } catch (e){

    // Internet Explorer Browsers

    try{

    ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");

    } catch (e) {

    try{

    ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");

    } catch (e){

     

    alert(" Your browser Broke ..!Pls Try Again ...!");

    return false;

    }

    }

    }

    // Create a function that will receive data sent from the server

    ajaxRequest.onreadystatechange = function(){

    if(ajaxRequest.readyState == 4){

    var ajaxDisplay = document.getElementById('div_Add_emp_info');

    ajaxDisplay.innerHTML = ajaxRequest.responseText;

    }

     

     

     

     

     

     

     

     

    }

     

              var com_tbl_id= document.getElementById("hdd_comp_id").value;

      var title=document.getElementById("title").value;

      var surname= document.getElementById("surname").value;

     

      var inintials= document.getElementById("initials").value;

      var name_d_initials= document.getElementById("name_d_inintials").value;

      var nic_no= document.getElementById("nic_no").value;

      var date_of_birth= document.getElementById("FrmDate").value;

      var sub_com_name=document.getElementById("comp_usb_div").value;

     

      var emp_no = document.getElementById("emp_no").value;

      var address_1= document.getElementById("add_1").value;

      var address_2= document.getElementById("add_2").value;

      var tow_city= document.getElementById("town_city").value;

      var province= document.getElementById("province").value;

      var agree= document.getElementById("chkagree").value;

      var new_add_1= document.getElementById("new_add_1").value;

      var new_add_2= document.getElementById("new_add_2").value;

      var new_town_city= document.getElementById("new_town_city").value;

      var mob_no= document.getElementById("mob_no").value;

      var office_telno= document.getElementById("office_telno").value;

      var res_telno= document.getElementById("res_tel_no").value;

      var emailno= document.getElementById("email_add").value;

     

     

     

        noOfSubmits++;

     

    if(noOfSubmits>1)

    {

    alert("Submission already done. Please wait while system is updating..!");

    return false;

    }

     

    else{

      emailno

    //var queryString = "?setle_agent_name="+settle_argent +"&set_address="+set_address+"&set_ag_telno="+set_telno +"&set_ag_fax_no="+set_faxno +"&set_ag_email_no="+set_email +"&set_ag_web="+set_web;

    var queryString = "?surname="+surname +"&comp_tblid="+com_tbl_id+"&initilas="+inintials +"&p_title="+title +

    "&name_denote_by_initials="+name_d_initials  +"&NIC_NO="+nic_no +"&DOb="+date_of_birth

    +"&sub_com_name="+sub_com_name +"&p_emp_no="+emp_no

    +"&adress1="+address_1 +"&adress2="+address_2 + "&towncity="+tow_city

    + "&province="+province + "&my_agree="+agree + "&new_address1="+new_add_1

    + "&new_address2="+new_add_2 + "&new_town_city="+new_town_city

    + "&office_telno="+office_telno + "&mob_no="+mob_no

    + "&residance_telno="+res_telno + "&email="+emailno;

     

    ajaxRequest.open("GET", "ajax_add_employee_infor.php" + queryString, true);

    ajaxRequest.send(null);

    clear_data();

     

     

    }

    }

     

     

     

     

  3. thanks guys for the support and it really works .thanks to all the people who support me

     

    here my calculation code

     

     

    include_once'./../include/connection_db.php';

    include_once'./../include/my_para_list.php';

     

    $category=$_GET['sum_insured']; 

     

    $srcctc_option=$_GET['srcctc'];

    $ndc_amount=$_GET['ndcamount'];

    //echo "dd".

    $pol_type=$_GET['poloption'];

    //print"<br>";

     

    $tot_premium=0;

    $ind_charge=0;

    $ndc_charge=0;

    $in_plus_fam_tot=0;

    $in_plus_fam_parent_tot=0;

    $in_plus_parent_tot=0;

    $srcctcc_charge=0;

     

     

    $result = mysql_query("SELECT * FROM policy_option WHERE pol_op_state='A' AND pol_op_sum_assured=$category");

     

    while ($row = mysql_fetch_assoc($result))

      {

      $indvidual = $row['pol_op_individual'];

    $ind_p_or_family = $row['pol_op_ind_plus_p_or_family'];

    $ind_p_family = $row['pol_op_ind_plus_p_plus_family'];

    $ndc = $row['pol_op_natural_death_cover'];

    $opsrsctc = $row['pol_op_srcc_tc'];

        }

     

    if ($pol_type==1) { $ind_charge=$ind_charge+$indvidual;} else{$ind_charge=0;}

    if ($pol_type==2) { $in_plus_fam_tot=$in_plus_fam_tot+$ind_p_or_family;} else{$in_plus_fam_tot=0;}

    if ($pol_type==3) { $in_plus_parent_tot=$in_plus_parent_tot+$ind_p_or_family;} else{$in_plus_parent_tot=0;}

     

    if ($pol_type==4) { $in_plus_fam_parent_tot=$in_plus_fam_parent_tot+$ind_p_family;} else{$in_plus_fam_parent_tot=0;}

     

     

    if ($ndc_amount==1) { $ndc_charge=$ndc_charge+$ndc;} else{$ndc_charge=0;}

    if ($srcctc_option==1) { $srcctcc_charge=$srcctcc_charge+$opsrsctc;} else{$srcctcc_charge=0;}

     

     

                $tot_premium=$tot_premium+$ind_charge+$in_plus_fam_tot+$in_plus_parent_tot+$in_plus_fam_parent_tot+$ndc_charge+$srcctcc_charge;

     

     

    echo number_format($tot_premium,2 );

     

  4. yes i am using php and with mysql .what will be the problem

     

     

    here is the full code

     

    //Browser Support Code

    function ajaxFunction(){

    var ajaxRequest;  // The variable that makes Ajax possible!

     

    try{

    // Opera 8.0+, Firefox, Safari

    ajaxRequest = new XMLHttpRequest();

    } catch (e){

    // Internet Explorer Browsers

    try{

    ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");

    } catch (e) {

    try{

    ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");

    } catch (e){

     

    alert("Your browser broke..!Pls Try Again ...!");

    return false;

    }

    }

    }

    // Create a function that will receive data sent from the server

    ajaxRequest.onreadystatechange = function(){

    if(ajaxRequest.readyState == 4){

    var ajaxDisplay = document.getElementById('diveInfo');

    ajaxDisplay.innerHTML = ajaxRequest.responseText;

    document.getElementById('result').value = xmlHttp.responseText;//

     

     

    }

    }

     

     

       

     

     

     

      var txtsum_inssured= document.getElementById("sumasssured").value;

      var txtsrcctc  = document.getElementById("srcctc").value;

      var txtndc  = document.getElementById("ndc").value;

      var txtradio  = document.getElementById("poloption").value;

     

     

      if(txtsum_inssured ==0)

    { alert("Select the Sum Insured Amount from the List ..!");

    document.getElementById("sumasssured").focus();

    return false;}

     

     

     

     

    else{ // var queryString = "?server_agent_name="+server_argent +"&set_address="+set_address+"&set_ag_telno="+set_telno +"&set_ag_fax_no="+set_faxno +"&set_ag_email_no="+set_email +"&set_upid="+tbl_my_id +"&prev_ag_name="+pre_ag_name +"&prev_ag_add="+pre_adddress +"&prev_ag_telno="+pre_telno +"&prev_ag_faxno="+pre_faxno +"&prev_ag_email="+pre_email_no +"&prev_set_agid="+pre_setagent_id +"&prev_town_id="+pre_townid +"&new_setle_id="+new_setid +"&new_town_id="+new_townid  ;

     

                var queryString = "?sum_insured="+txtsum_inssured +"&srcctc="+txtsrcctc+"&ndcamount="+txtndc +"&poloption="+txtradio;

     

    ajaxRequest.open("GET", "script/ajax_get_policy_infor.php" + queryString, true);

    ajaxRequest.send(null);

    }

    }

     

  5. where to put it my code here

     

    function ajaxFunction(){

    var ajaxRequest;  // The variable that makes Ajax possible!

     

    try{

    // Opera 8.0+, Firefox, Safari

    ajaxRequest = new XMLHttpRequest();

    } catch (e){

    // Internet Explorer Browsers

    try{

    ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");

    } catch (e) {

    try{

    ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");

    } catch (e){

     

    alert("Your browser broke..!Pls Try Again ...!");

    return false;

    }

    }

    }

    // Create a function that will receive data sent from the server

    ajaxRequest.onreadystatechange = function(){

    if(ajaxRequest.readyState == 4){

    var ajaxDisplay = document.getElementById('diveInfo');

    ajaxDisplay.innerHTML = ajaxRequest.responseText;

     

     

    }

    }

     

     

       

     

  6. I just want to display some calculated variable in a text box of a form from ajax .how to call the variable

    from ajax to display in the text  box

     

    my ajax calculation was done ,the problem is that how to call the variable it the text box

     

    Help

     

  7.   $sever_name=ucwords(strtolower($_POST['agent_name']));

      $server_address=addslashes(trim(($_POST['set_address']));

      $se_telno=addslashes(($_POST['set_ag_telno']);

      $set_faxno=addslashes(($_POST['set_ag_fax_no']);

      $set_email=($_POST['set_ag_email_no'];

      $setl_id=($_POST['settle_agent'];

      $set_townid=($_POST['mytown'];

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

      $blank_check=checkblank($sever_name,$server_address,$se_telno,$set_faxno,$set_email,$setl_id,$set_townid);

     

      if($blank_check==true){

    $er_msges="<br/><br/> <font size=2 color=#FF0000><b> Error In Data Submitting ...! Please Try Again ..! </b> </font><br/><br/><br/>";

      }

      else{

                      if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/",$set_email)){

      $er_msges="<b><font size=2 color=#FF0000>E-mail Address :".' '.' '.$set_email." Not a valid Email Address Format...! </font></b>";

    }

      else{

     

              //$check_exixts=check_server_argent_exits($sever_name);

            //if($check_exixts ==true ){

          $er_msges= "<b><font size=2 color=#FF0000>Server agent ".' '.' '.$sever_name." Exists in the system ...! </font></b>";

     

          //}

    //else{

     

            $query_101 = "INSERT INTO ual_admin_server_agent (ad_server_agent_name,ad_server_agent_address,ad_server_agent_telno,ad_server_agent_fax_no,ad_server_agent_email,ad_server_agent_settle_agent_id,ad_server_agent_town_id,ad_server_agent_modify_status,ad_server_agent_del_status,ad_server_agent_ustate,ad_server_agent_add_date) VALUES('$sever_name','$server_address',$se_telno,$set_faxno,'$set_email',$setl_id,$set_townid,'N','N','N','$today')";

                                        $result_101 = mysql_query($query_101) ; 

     

    if($result_101){

                    $er_msges= "<b><font size=2s color=#000000>Server Agent".' '.' '.$sever_name." Suceessfully Saved In The System ...! </font></b>";

                      }

    else{

                      $er_msges= "<b><font size=2s color=#FF0000>Server Agent".' '.' '.$sever_name." Added to the system Fails...! </font></b>";

     

    }

     

     

     

    // }  

     

     

     

     

     

        //} //perg web address  

     

     

        } ///preg else

       

     

     

        } //if fist else

     

         

  8.   $sever_name=ucwords(strtolower($_POST['agent_name']));

      $server_address=addslashes(trim(($_POST['set_address']));

      $se_telno=addslashes(($_POST['set_ag_telno']);

      $set_faxno=addslashes(($_POST['set_ag_fax_no']);

      $set_email=($_POST['set_ag_email_no'];

      $setl_id=($_POST['settle_agent'];

      $set_townid=($_POST['mytown'];

     

     

     

     

     

     

     

     

     

     

     

     

     

     

     

      $blank_check=checkblank($sever_name,$server_address,$se_telno,$set_faxno,$set_email,$setl_id,$set_townid);

     

      if($blank_check==true){

    $er_msges="<br/><br/> <font size=2 color=#FF0000><b> Error In Data Submitting ...! Please Try Again ..! </b> </font><br/><br/><br/>";

      }

      else{

                      if (!preg_match("/\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*/",$set_email)){

      $er_msges="<b><font size=2 color=#FF0000>E-mail Address :".' '.' '.$set_email." Not a valid Email Address Format...! </font></b>";

    }

      else{

     

              //$check_exixts=check_server_argent_exits($sever_name);

            //if($check_exixts ==true ){

          $er_msges= "<b><font size=2 color=#FF0000>Server agent ".' '.' '.$sever_name." Exists in the system ...! </font></b>";

     

          //}

    //else{

     

            $query_101 = "INSERT INTO ual_admin_server_agent (ad_server_agent_name,ad_server_agent_address,ad_server_agent_telno,ad_server_agent_fax_no,ad_server_agent_email,ad_server_agent_settle_agent_id,ad_server_agent_town_id,ad_server_agent_modify_status,ad_server_agent_del_status,ad_server_agent_ustate,ad_server_agent_add_date) VALUES('$sever_name','$server_address',$se_telno,$set_faxno,'$set_email',$setl_id,$set_townid,'N','N','N','$today')";

                                        $result_101 = mysql_query($query_101) ; 

     

    if($result_101){

                    $er_msges= "<b><font size=2s color=#000000>Server Agent".' '.' '.$sever_name." Suceessfully Saved In The System ...! </font></b>";

                      }

    else{

                      $er_msges= "<b><font size=2s color=#FF0000>Server Agent".' '.' '.$sever_name." Added to the system Fails...! </font></b>";

     

    }

     

     

     

    // }  

     

     

     

     

     

        //} //perg web address  

     

     

        } ///preg else

       

     

     

        } //if fist else

     

         

  9. I need a ajax ,php code for change the user login pass word

     

    Currrent pass word :

     

    New password

    Retype password

     

     

    If the current password is mismatch with the database password ajax error message have to be displays

     

    If new password is not equal to the  retype password ajax message have to be display

     

    Can u show us a sample code

     

  10. When typing “+65 6225 0428” as the far fax number filed when submit data to my sql in the php page it gives an eeror in the php code .

     

     

    How to prevent the above error

     

  11. document.getElementById("div_id_naMr").innerHTML="hello";  will display the  hello text in the web browser . i just want to diplay the hello in the web browser in the red color . How to color up the text with ajax

     

    i want to keep the color in the javascript file

     

     

  12. really easy

     

    function ajaxFunction(){

    var ajaxRequest;  // The variable that makes Ajax possible!

     

    try{

    // Opera 8.0+, Firefox, Safari

    ajaxRequest = new XMLHttpRequest();

    } catch (e){

    // Internet Explorer Browsers

    try{

    ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");

    } catch (e) {

    try{

    ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");

    } catch (e){

     

    alert("Your browser broke..!Pls Try Again ...!");

    return false;

    }

    }

    }

    // Create a function that will receive data sent from the server

    ajaxRequest.onreadystatechange = function(){

    if(ajaxRequest.readyState == 4){

    var ajaxDisplay = document.getElementById('divAdd_PromotionsInfo');

    ajaxDisplay.innerHTML = ajaxRequest.responseText;

    }

    }

     

     

          var csc  = document.getElementById("txtboxname").value;

         

     

      var queryString = "?pcsc="+csc+;

     

    ajaxRequest.open("GET", "test.php" + queryString, true);

    ajaxRequest.send(null);

    }

    }

     

     

    in the test.php page write the insert qurey and get the message to div tag and display the result

     

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.