Skip to content

Tag: xmlhttprequest

AJAX POST request to a PHP server: Invalid request (Malformed HTTP request) on console and net::ERR_EMPTY_RESPONSE on chrome dev tools

I have the files test.html, test.js and test.php in my directory. I am trying to send some data to my backend, which should be dealt with by test.php. I run my server using PHP’s built-in webserver with the command php -S -t test-server/. Here’s a simplified demonstration, whenever I click “submit”, it should send the data to my php

AJAX with XMLHttpRequest doesn’t send data

I want to build a simple program using XMLHttpRequest to calculate the area of the triangle. I used this code for client-side; This code is for the server side. Even tried so many codes, It doesn’t send the data to server side. Answer I found the mistake. I was sending the parameters as part of the URL, but need to

XMLHttpRequest not sending token (Laravel page expired)

I’m using Laravel and trying to send a form via XMLHttpRequest. It works but the request in the controller doesn’t identify it as ajax. The form has a csrf input. I’ve tried several things, right now my code looks like: But Laravel keeps sending a 419 | Page Expired response. Maybe I’m misinterpreting this information, barking at the wrong tree,

Output PHP already encode to json, and send to javascript to be json, not working

I’m do output with json_encode to sending to javascript, with this code. so output show like this, [{“id”:”121353568″,”name”:”Baju Casual – Black”},{“id”:”556903232″,”name”:”Tas LV – Red”},{“id”:”795953280″,”name”:”Sword – Wood”},{“id”:”834032960″,”name”:”Scooter – Iron Plate”}] and code javascript like this so its not working, output show undifined. Answer I use ajax calls when I want to call a Php file and get a response from

Sending password over XML HTTP request post (HTTPS enabled)

Could use some help sorting out best practices with sending passwords in XML requests. I need to collect input from an HTML form, and if the provided password matches what’s on the server, insert the data from the form into a database. I’d like to do this via Javascript/XML requests so I can display a confirmation message in place using