Hi,

I have these two files...index.html and handle.php

Index.html has a form on it which is sent to handle.php. This file takes the data sent from index.html then processes it and returns some text.

What I want to do is 'Ajaxify' this whole process, so to speak.

How can I do this?

On your form's onsubmit event call a js function which will initiate the ajax request.

.
.
.
<form onsubmit='sendAjaxRequest(this)'>
    <input type='text' name='textfield1'>
    .
    .
    .
</form>
.
.
.

And in js code initiate the ajax request

function sendAjaxRequest(form) {
    var param1 = form.textfield1.value;
    var param2 = .....;

    var url='path for handle.php?param1=' + param1 + '&param2=' +  param2 + '&'.....;
    // Send Ajax request
    
}

// Success Handler for the Ajax request
function successHandler() {
    // Code to update the page (index.html)
}

This is a brief road map to implement ajax.
For more details read more about how to implement ajax.

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.