$("#agent_edit_form").submit(function(event) {
htmlForm = new FormData( this );
htmlForm.append = $("#agent_edit_form");
console.log(htmlForm);
$.ajax( {
url: 'edit_agent.php?id=<?php echo $agent_id ?>',
type: 'POST',
data: htmlForm,
processData: false,
contentType: false,
success: function(data){
$("#clients_container").html(data);
}
} );
event.preventDefault();
});
PHP:
<?php
if(isset($_GET['id'])){
$firstname = $_POST["firstname"];
$middlename = $_POST["middlename"];
$lastname = $_POST["lastname"];
$birthdate = $_POST["birthdate"];
$age = $_POST["age"];
$TIN = $_POST["TIN"];
$SSS = $_POST["SSS"];
$email = $_POST["email"];
$telno = $_POST["telno"];
$faxno = $_POST["faxno"];
$cellno = $_POST["cellno"];
$address = $_POST["address"];
?>
im trying to use this FORMDATA to submit form data and a file(image).jpg but its not working can you check what seems to be the problem? it is returning the same data or it remains unchanged after the success.
i can see that there is data in htmlForm since im checking it using the console.log
but it seems the php is not triggering or is not receiving the posted data from ajax. (note: the JS is in the same file as the PHP code)
thanks!