PHP Classes

Recommendation for a PHP class to how to call class and function: Call functions and class in PHP and HTML page

Recommend this page to a friend!
  All requests RSS feed  >  Recommendation for a PHP class to how...  >  Request new recommendation  >  A request is featured when there is no good recommended package on the site when it is posted. Featured requests  >  No recommendations No recommendations  

Recommendation for a PHP class to how to call class and function

Edit

Picture of Sufiyan Syed by Sufiyan Syed - 8 months ago (2024-02-24)

Call functions and class in PHP and HTML page

This request is clear and relevant.
This request is not clear or is not relevant.

+1

I have an HTML page with some text fields.

When the user enters the text fields, it should call either a function or class of PHP.

I appreciate your support.

  • 2 Clarification requests
  • 2. Picture of Cedric Maenetja by Cedric Maenetja - 7 months ago (2024-03-18) Reply

    There are two ways you can call PHP,

    1) onchange element function make an api call <script> $(document).ready(function(){ $("#elementid").change(function(){

    // make an api call
    $.ajax({
        type: "POST",
        url: url,
        data: data,
        success: success,
        dataType: dataType
    });
    

    }); }); </script>

    2) Call the function explicitly in onchange element function <?php

    function alertDialog(){
        echo "alert('PHP function called.');";
    }
    

    ?> some html code... <script> $(document).ready(function(){ $("#fname").change(function(){

    // call PHP function explicitly
    <?php alertDialog(); ?>
    

    }); }); </script>

    • 1. Picture of The Algoslingers by The Algoslingers - 8 months ago (2024-02-25) Reply

      Are you talking about as soon as the user enter some text/input, the data is sent to a backend and then return a resulting indicating the input is correct or wrong or this and that or returns data according what the user typed?

      Ask clarification

      1 Recommendation

      Jaxon: Call PHP classes from JavaScript using AJAX

      This recommendation solves the problem.
      This recommendation does not solve the problem.

      0

      Picture of Manuel Lemos by Manuel Lemos Reputation 24325 - 7 months ago (2024-03-20) Comment

      Hello Sufyiian,

      The JAXON package does what you need. It can generate JavaScript to send requests to PHP on the server side, so you can implement responses with the information that your forms need on the browser side to process those responses with JavaScript code.

      Can you test this package and let us know if it works for you or if you need something better?


      Recommend package
      : 
      :