Home Ajax POST Failing Every Time
Reply: 0

Ajax POST Failing Every Time

user589
1#
user589 Published in April 25, 2018, 12:27 pm

I have tried multiple ways of sending a post, such as a XMLHttpRequest. All of them ended in the post failing.
I am using XAMPP to run the webpage this is for.

JS

var obj = {
        title: $("form input[name=title]").val(),
        desc: $("form input[name=desc]").val(),
        etc...
    };
$.post("newpost.php", {data: JSON.stringify(obj)}, function(response){
    console.log("Response: "+response);
}).fail(function(result){
    console.log("Fail "+result);
});  

PHP

echo $_POST["data"];
You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.444844 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO