after finding out that i couldn't use form submit (which refreshes the page) alongside bockui i have decided to move onto ajax. i am not too good at ajax but i get the gist of it. but now block ui does not wish to work at all. here is the javascript i am using:

$(document).ready(function() {

    //if submit button is clicked
    $('#submit').click(function () {        

        //Get the data from all the fields
        var status = $('input[name=status]');
        var pRent = $('input[name=pRent]');
        var rentPaid = $('input[name=rentPaid]');
        var pDate = $('input[name=pDate]');

        //Simple validation to make sure user entered something
        //If error found, add hightlight class to the text field
        if (status.val()=='') {
            return false;
        } else status.removeClass('hightlight');

        if (pRent.val()=='') {
            return false;
        } else pRent.removeClass('hightlight');

        if (rentPaid.val()=='') {
            return false;
        } else rentPaid.removeClass('hightlight');

                if (pDate.val()=='') {
            return false;
        } else pDate.removeClass('hightlight');

        //organize the data properly
        var data = 'status=' + status.val() + '&pRent=' + pRent.val() + '&rentPaid='
        + rentPaid.val() + '&pDate=' + pDate.val();

        //disabled all the text fields

        //show the loading sign

        //start the ajax
            //this is the php file that processes the data and send mail
            url: "resources/process.php",   

            //GET method is used
            type: "GET",

            //pass the data         
            data: data,     

            //Do not cache the page
            cache: false,

            success: function (html) {              
                //if process.php returned 1/true (send mail success)
                if (html==1) {                  


            $.blockUI({ message: $('#question'), css: { width: '1024px' } });  
        $('#yes').click(function() { 
            // update the block message 
            $.blockUI({ message: "<h1>Remote call in progress...</h1>" }); 

                url: 'wait.php', 
                cache: false, 
                complete: function() { 
                    // unblock when remote call returns 

        $('#no').click(function() { 
            return false; 

                //if process.php returned 0/false (send mail failed)
                } else alert('Sorry, unexpected error. Please try again later.');               

        //cancel the submit button default behaviours
        return false;


//Retrieve form data. 
//GET - user submitted data using AJAX
//POST - in case user does not support javascript, we'll use POST instead
$status = ($_GET['status']) ? $_GET['status'] : $_POST['status'];
$pRent = ($_GET['pRent']) ?$_GET['pRent'] : $_POST['pRent'];
$rentPaid = ($_GET['rentPaid']) ?$_GET['rentPaid'] : $_POST['rentPaid'];
$pDate = ($_GET['pDate']) ?$_GET['pDate'] : $_POST['pDate'];

any thanks would be appreciated. God bless you in advance!


I guess resources/process.php returns '1' or '0', which are strings not numbers, so html==1 will always return false.

Try html=='1' .


Correction -

Sorry html==1 returns true even when html=='1' .

The problem must be elsewhere in the code.