Hello everyone!

I have a question .. i have a js file (script.js) and a php file (script.php) , in the php file i have a code that verify a user and in the script js i have this:

var uname = name.val();
        $.post('HERE IS THE QUESTION' , {names:uname} , function(data){
            if (data != 1){
                name.removeClass('valid');
                nameInfo.removeClass('valid');
                name.addClass('error');
                nameInfo.addClass('error');
                nameInfo.text("This name is already registered!");
                state = false;

My question is : How can i call the object that verify the username from scrip php ( This is made like the code below ) in the script.js .. the folder is core / script.php & core/script.js

class VerifyScript{

    function verify(){
    #code
    }

}

Thank you in advance !

Recommended Answers

All 4 Replies

POST to the URL of the php script.

Ok , actually , you didn't understand or I didn't understand the answer ..is not a php script , is a function , how can i call the FUNCTION from the CLASS from the php script?

The php look like this :

<?php 

class 1{

    function I_NEED_TO_CALL_THIS_FUNCTION{
    #code
    }

}

class 2{

    function ANOTHER_FUNCTION{
    #code of another function
    }

}

And I need to call the function "I_NEED_TO_CALL_THIS_FUNCTION" from the Class "1"

$.post('script.php'

in script.php
if(isset($_POST['names'])) print_r($_POST['names']);

Thank's :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.