PHP Classes

File: ajax.js

Recommend this page to a friend!
  Classes of Pierre-Henry Soria  >  PHP AJAX Calculator  >  ajax.js  >  Download  
File: ajax.js
Role: Auxiliary data
Content type: text/plain
Description: Auxiliary data
Class: PHP AJAX Calculator
Perform calculations and get the results via AJAX
Author: By
Last change:
Date: 11 months ago
Size: 733 bytes
 

 

Contents

Class file image Download
/*
 * Author:           Pierre-Henry Soria <pierrehenrysoria@gmail.com>
 * Copyright:        (c) 2015, Pierre-Henry Soria. All Rights Reserved.
 * License:          MIT License <http://www.opensource.org/licenses/mit-license.php>
 * Link:             http://github.com/pH-7/
 */

$('#submit').click( function()
{
    var sFormName = 'form[name=calculator] ';
    var oData =
    {
        op : $(sFormName + '#operation').val(),
        lho : $(sFormName + '#left_operand').val(),
        rho : $(sFormName + '#right_operand').val()
    };

    $.get('call.php', oData, function(oOutput)
    {
        $('#result').text( $(oOutput).find('result').text() );
        $('#summary').text( $(oOutput).find('summary').text() );
    });
});

For more information send a message to info at phpclasses dot org.