My website is using PHP 7.1. As I know, JSON had been removed because of some reasons, however, that doesn’t matter, I have an extension named JSOND to install on my localhost, which is exactly like JSON.
The problem is that I can’t install this extension on 000webhost, I can’t find a way to install it , I tried to use JSON methods instead (json_decode instead of jsond_decode) but it still keep telling me I have called an undefined function
Please help me to fix this
Here the details:
“Fatal error: Uncaught Error: Call to undefined function GuzzleHttp\json_decode() in /storage/ssd3/871/4200871/public_html/sort-section.php:26
Stack trace: #0 {main}
thrown in /storage/ssd3/871/4200871/public_html/sort-section.php on line 26 ”
@young666 Sorry for the inconvenience, 000webhost is intended for hobby/small projects, so it is limited. This is why you can’t install any extensions on 000webhost.
Consider a Premium Plan, which will solve you issue.
Check cheap premium plans here: Hostinger.
// Serialize the data in the form
var sectionOrderJSON = JSON.stringify(sectionOrder);
var subsectionOrderJSON = JSON.stringify(subsectionOrder);
request = $.ajax({
url: "sort-section.php",
type: "post",
data: {
sectionOrder: sectionOrderJSON,
subsectionOrder: subsectionOrderJSON
},
cache: false
});
I use “request =” to log the result into console on whether success or failure. And as above, I have switched to 5.6 version but the site gave me 502 Bad Gateway
Here the address I put the code: pluperfect-leapers.000webhostapp(.)com/manage-section.php (new user can’t post more than 1 link, sorry for this inconvenience).
$('#manage-section').submit(function (event) {
// Prevent default posting of form - put here to work in case of errors
event.preventDefault();
console.log(sectionOrder);
// Abort any pending request
if (request) {
request.abort();
}
// Serialize the data in the form
var sectionOrderJSON = JSON.stringify(sectionOrder);
var subsectionOrderJSON = JSON.stringify(subsectionOrder);
request = $.ajax({
url: "sort-section.php",
type: "post",
data: {
sectionOrder: sectionOrderJSON,
subsectionOrder: subsectionOrderJSON
},
cache: false
});
// Callback handler that will be called on success
request.done(function (response, textStatus, jqXHR) {
// Log a message to the console
console.log("Saved!");
alert("Đã lưu thành công!!!");
});
// Callback handler that will be called on failure
request.fail(function (jqXHR, textStatus, errorThrown) {
// Log the error to the console
console.error(
"The following error occurred: " +
textStatus, errorThrown
);
});
location.reload();
});