Page 1 of 3 123 LastLast
Results 1 to 10 of 23

Thread: ajax question

  1. #1

    Default ajax question


    I have 2 php files.
    let's say

    A.php & B.php

    Si A.php nag gamit ug javascript for computing the total. It's a running total to be specific.

    Then sa A.php naa koi button (Save) inig click sa button, mu adto dayun ni B.php para i save sa database.

    So bale ang flow ana is thike this.

    a. Compute Running Total then click save
    b. Pass to ajax code
    c. Save to DB

    Ang problema nako run is, kung gamitan nako siya ug ajax, mawala ang akong running total. idk why that is. Kai kung buot huna hunaun ang ajax nga code, i read raman after na ug click sa save nga button.


    so question, mag conflict ba ang ajax ug ang JS? O_o

    BTW bag o rako aning ajax. so don't be so technical T_T

  2. #2
    can you post your codes here please so that ma-analyze nato?

  3. #3
    kani nalang ai...code sa button

    <input type="button" value="SAVE" onclick = "getData('B.php', 'content','3')"/>

    nya ang sa running total kai more or less ing ani.

    <script type="text/javascript">
    function startCalc(){
    interval = setInterval("calc()",1);
    }
    function calc(){
    one = document.autoSumForm.firstBox.value;
    two = document.autoSumForm.secondBox.value;
    document.autoSumForm.thirdBox.value = (one * 1) + (two * 1);
    }
    function stopCalc(){
    clearInterval(interval);
    }
    // End -->
    </script>

  4. #4
    Ok, hint nlng... try to check if conflict ba ID nimo sa javascript and AJAX... mao lng na ako mahelp nimo ky wa mn ko idea if gunsa nimo pgstructure...

  5. #5
    what do you mean conflict ang ID sa JS ug ang sa Ajax?

  6. #6
    Quote Originally Posted by c-chan View Post
    kani nalang ai...code sa button
    <script type="text/javascript">
    function startCalc(){
    interval = setInterval("calc()",1);
    }
    function calc(){
    one = document.autoSumForm.firstBox.value;
    two = document.autoSumForm.secondBox.value;
    document.autoSumForm.thirdBox.value = (one * 1) + (two * 1);
    }
    function stopCalc(){
    clearInterval(interval);
    }
    // End -->
    </script>

    asa mn ang mka trigger ani na function?

  7. #7
    <form name="autoSumForm">
    <input type=text name="firstBox" value="" onFocus="startCalc();" onBlur="stopCalc();"> +
    <input type=text name="secondBox" value="" onFocus="startCalc();" onBlur="stopCalc();"> =
    <input type=text name="thirdBox">
    </form>

    kani? di jud ni mao akong code ha. bale mao lang ni siya basis. ako rani nakit ana sa net.

  8. #8
    ngano mn dili nimo pwede mapakita ang entire code?

  9. #9
    ang company tag iya ato...ehehe...makasab an palang ko >.<

    kung school project palang ni ako na unta gi post. but its not T.T

  10. #10
    awww, company diay? abi nako school exercise... tsk tsk tsk...

    the problem is on the form... every time ma off-focus sa field tawagon daun niya ang stopCalc() so mao na ang reason na iclear niya... try to simplify it... don't complicate...

  11.    Advertisement

Page 1 of 3 123 LastLast

Similar Threads

 
  1. 5 Questions Every Man Dreads -- and Why
    By tikboy in forum "Love is..."
    Replies: 43
    Last Post: 03-04-2012, 01:40 PM
  2. Hair Care~ Information, Tips, Questions and Answers please
    By chime_888 in forum Fitness & Health
    Replies: 103
    Last Post: 09-03-2011, 04:03 PM
  3. A Question on Guys who dump girls
    By SweetCatEyes in forum "Love is..."
    Replies: 247
    Last Post: 05-24-2011, 09:50 AM
  4. Replies: 59
    Last Post: 05-05-2009, 10:00 PM
  5. How To Ask Questions The Smart Way
    By $dbpasswd in forum Support Center
    Replies: 14
    Last Post: 02-03-2006, 06:19 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
about us
We are the first Cebu Online Media.

iSTORYA.NET is Cebu's Biggest, Southern Philippines' Most Active, and the Philippines' Strongest Online Community!
follow us
#top