Click here to Skip to main content
16,004,906 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
calculate.php

    <form method="post" name="frm_deptcal" id="frm_deptcal"     action="javascript:add(document.getElementById('frm_deptcal'));" >
    <span style="font-weight:bold;">Enter your total unsecured* debt </span>
    <input type="text" name="txt_principal" id="txt_principal" / >
    <input type="submit" name="button" value="Calculate" style="background: none repeat scroll 0% 0% rgb(51, 136, 180); color: white; border: 5px solid rgb(120, 176, 205); cursor: pointer;">
    </form>


in ajax_cal.js i have add() in which XMLHttpRequestObject is created and string is  send
code :

   <pre> var str1= "txt_principal=" + document.getElementById("txt_principal").value;
    XMLHttpRequestObject.onreadystatechange = show;
    XMLHttpRequestObject.open('POST', 'value.php', true);
    XMLHttpRequestObject.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    XMLHttpRequestObject.send(str1);


In value.php i have done calculation:

    $principal=$_POST['txt_principal'];
    $x=0.3;
    $consumer_mon_pay=60;
    $mp_consumer_ans=($principal * $x)/$consumer_mon_pay;
    $mp_consumer=round($mp_consumer_ans,3)   ;
    echo $mp_repay."[BRK]".$mp_conloan."[BRK]".$mp_credit."[BRK]".$mp_consumer;

 and in ajax_cal.js  i have got the response as html and showed in textbox

    function show()
    {
        if (XMLHttpRequestObject.readyState == 4)
        {
            if (XMLHttpRequestObject.status == 200)
            {
                data = XMLHttpRequestObject.responseText.split("[BRK]");
                document.getElementById('txt_mp_repay').innerHTML = data[0];
                document.getElementById('txt_mp_conloan').innerHTML = data[1];
                document.getElementById('txt_mp_credit').innerHTML = data[2];
                document.getElementById('txt_mp_consumer').innerHTML = data[3];

            }
        }

    }


now my problem is I have to plot a dynamic graph whose x -axis should be the (txt_mp_repay,txt_mp_conloan,txt_mp_credit,txt_mp_consumer ) values and y -axis will be txt_mp_repay value .the bar graph coding is done using open-flash chart in chart-data.php through which I have created a static graph.Problem is how to send the response to chart-data.php and show the whole thing on calculate .php page.Help me...Thanks
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900