Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var uri = "http://localhost/aniadir.php"
- $.ajax({
- url: uri,
- data: data,
- method: "POST",
- dataType:"json",
- async: true,
- success: function (response) {
- console.log("OK" + response.data.message);
- },
- error: function (xhr, textStatus, errorMessage) {
- console.log("ERROR" + errorMessage + textStatus + xhr);
- }
- }); // end ajax
- $mysqli = new mysqli('localhost', 'root', 'error', 'tabla');
- $jsondata["success"] = false;
- $jsondata["data"] = array(
- 'message' => $mysqli->error
- );
- header('Content-type: application/json; charset=utf-8');
- echo json_encode($jsondata, JSON_FORCE_OBJECT);
Add Comment
Please, Sign In to add comment