Let’s start with:
Let’s do a full clean re-install;
Note: Firefox comes in three or more folders on all computers. They are;
Maintenance: (Programs Folder) <Windows Only>
Firefox itself: (Programs Folder)
And two folders in the profile of each user on the computer
for each Firefox profile for that user.
If you remove the Firefox folder, the user profiles would not be affected.
Download Firefox For All languages And Systems {web link}
Firefox ESR; Extended Support Release {web link}
Beta, Developer, Nightly versions
https://www.mozilla.org/en-US/firefox/channel/desktop/
Install Older Version Of Firefox {web link}
Save the file. Then Close Firefox.
Using your file browser, open the Programs Folder on your computer.
Windows: C:\Program Files
C:\Program Files (x86) Note: Check Both Folders
Mac: Open the «Applications» folder.
https://support.mozilla.org/en-US/kb/how-download-and-install-firefox-mac
Linux: Check your user manual.
If you installed Firefox with the distro-based package
manager, you should use the same way to uninstall it.
See Install Firefox on Linux;
https://support.mozilla.org/en-US/kb/install-firefox-linux
If you downloaded and installed the binary package
from the Firefox download page, simply remove the
folder Firefox in your home directory.
http://www.mozilla.org/firefox#desktop
++++++++++++++++++++++++++++
Look for, and remove any Mozilla or Firefox program folders.
Do not remove the Mozilla Thunderbird folder if there is one.
Do Not remove any profile folders.
After rebooting the computer, run a registry scanner
if you have one. Then run the installer.
+++++++++++++++++++++++++++
If there is a problem, start your Computer in safe mode and try again.
How to Start all Computers in Safe Mode; {web link}
Free Online Encyclopedia
Make sure you’re php server is running and that the php code is in the appropriate folder. I ran into this same issue if the php was not there. I also recommend putting your html in that same folder to prevent cross-origin errors when testing.
If that is not the issue, ensure that every SQL call is correct in the php, and that you are using current php standards… Php changes quickly, unlike html, css and Javascript, so some functions may be deprecated.
Also, I noticed that you may not be collecting your variable correctly, which can also cause this error. If you are sending variables via form, they need to be in proper format and sent either by POST or GET, based on your preference. For example, if I had a login page for a maze game:
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<form class="modal-content animate" method="post">
<div class="container">
<label><b>Username</b></label>
<input type="text" id="usernameinput" placeholder="Enter username" name="uname" required>
<label><b>Password</b></label>
<input type="password" id="passwordinput" placeholder="Enter Password" name="psw" required>
<button onclick="document.getElementById('id01').style.display='block'">Sign Up</button>
<button type="button" id="loginsubmit" onclick="myLogin(document.getElementById('usernameinput').value, document.getElementById('passwordinput').value)">Login</button>
</div>
</form>
JavaScript
function myLogin(username, password){
var datasend=("user="+username+"&pwd="+password);
$.ajax({
url: 'makeUserEntry.php',
type: 'POST',
data: datasend,
success: function(response, status) {
if(response=="Username or Password did not match"){
alert("Username or Password did not match");
}
if(response=="Connection Failure"){
alert("Connection Failure");
}
else{
localStorage.userid = response;
window.location.href = "./maze.html"
}
},
error: function(xhr, desc, err) {
console.log(xhr);
console.log("Details: " + desc + "\nError:" + err);
var response = xhr.responseText;
console.log(response);
var statusMessage = xhr.status + ' ' + xhr.statusText;
var message = 'Query failed, php script returned this status: ';
var message = message + statusMessage + ' response: ' + response;
alert(message);
}
}); // end ajax call
}
PHP
<?php
$MazeUser=$_POST['user'];
$MazePass=$_POST['pwd'];
//Connect to DB
$servername="127.0.0.1";
$username="root";
$password="password";
$dbname="infinitymaze";
//Create Connection
$conn = new MySQLi($servername, $username, $password, $dbname);
//Check connetion
if ($conn->connect_error){
die("Connection Failed: " . $conn->connect_error);
echo json_encode("Connection Failure");
}
$verifyUPmatchSQL=("SELECT * FROM mazeusers WHERE username LIKE '$MazeUser' and password LIKE '$MazePass'");
$result = $conn->query($verifyUPmatchSQL);
$num_rows = $result->num_rows;
if($num_rows>0){
$userIDSQL =("SELECT mazeuserid FROM mazeusers WHERE username LIKE '$MazeUser' and password LIKE '$MazePass'");
$userID = $conn->query($userIDSQL);
echo json_encode($userID);
}
else{
echo json_encode("Username or Password did not match");
}
$conn->close();
?>
It would help if you included the other parts of the code such as the html and JavaScript as I wouldn’t have to give my own example like this. However, I hope these pointers help!
«XML Parsing error: no root element found» in the Firefox browser’s console after uploading a file using AjaxFileUpload #377
Comments
svetlanamutu commented Aug 2, 2017 •
I am trying to use the AjaxFileUpload control from the ASP.NET AJAX Toolkit v17.1.1.0 in my ASP.NET web application. Whenever the file gets uploaded, I get an error logged int he console of developer tools in Firefox:
‘
XML Parsing Error: no root element found
Location: https://someserver.domain.com/Review/AjaxFileUploadHandler.axd?contextKey=&controlID=MainContent_AjaxFileUpload1&fileId=4B36466C-D84E-B92F-8104-DB63A69D67B4&fileName=Penguins.jpg&chunked=false&firstChunk=true
Line Number 1, Column 1:
AjaxFileUploadHandler.axd:1:1
‘
I was able to reproduce the same error with your demo page in the Firefox browser (latest version — 54.0.1, 32-bit, Funnelcake Onboarding Q1 2017 -v1.6 variation mozilla102 — 1.0) at: https://ajaxcontroltoolkit.devexpress.com/AjaxFileUpload/AjaxFileUpload.aspx.
Please help me understand how to fix it.
Thank you so much,
Svetlana
The AJAX Control Toolkit
The installation method
- Installer
- NuGet package
- A custom build from the source code
Minimal steps to reproduce the bug
Just place an the AjaxFileUpload on an empty web form (default page of a web application project in asp.net) and try to use the AjaxFileUpload control with Firefox browser.
Actual result
Expected result
Browser(s) used
Firefox. Chrome and IE do not log this error in the console.
A site deployment method
- VS development web-server,
- [ x] IIS
The text was updated successfully, but these errors were encountered:
Источник
Xml parsing error no root element found
Search Support
- Home
- Support Forums
- Firefox for Android
- XML Parsing Error: no root element found
Avoid support scams. We will never ask you to call or text a phone number or share personal information. Please report suspicious activity using the “Report Abuse” option.
Learn More
XML Parsing Error: no root element found
- 4 replies
- 2 have this problem
- 2415 views
- Last reply by Harrison Bergmann
Then I tried open any site in Firefox on Android I saw next error:
XML Parsing Error: no root element found Location: chrome://geckoview/content/geckoview.xhtml Line Number 1, Column 1:
I also attach screenshots with error and browser version
Chosen solution
This is an issue that our developers are investigating. You can follow progress and add comments at:
Источник
Xml parsing error no root element found
After update to 90.1.3 version Firefox can not open web pages. It’s shown the error in each page (even in addons page.
» XML Parsing Error: no root element found Location: Chrome://geckoview/content/geckoview.xhtml Line Number 1, Column 1:
^ » I don’t know why it’s referring to chrome, but this text appeared in each page.
Accurate application version data: 90.1.3 (Build #2015824995) AC: 90.0.15, ef1436afb0 GV: 90.0.3-20210729144040 AS: 77.0.2
Thursday 7/29 @ 8:03 PM
Device data: Meizu M6Note Android 7.1.2
Modified August 6, 2021 at 8:01:41 PM PDT by osigotx
Chosen solution
Unless you have them synced to another copy of Firefox on your device or a desktop, bookmarks and tabs would be lost on reinstall. Please can you try the Beta version from the Google Play store?
I solved the problem by updating the application to an old version — installed apk of 91.1.0 (Build # 2015826185). For some reason, the installation didn’t work at first, but now everything worked out (the phone is old, no wonder there are glitches).
All Replies (9)
Accurate application version data: 90.1.3 (Build #2015824995) AC: 90.0.15, ef1436afb0 GV: 90.0.3-20210729144040 AS: 77.0.2
Thursday 7/29 @ 8:03 PM
Device data: Meizu M6Note Android 7.1.2
Do you have an example of a page that you are trying to open?
Hi Do you have an example of a page that you are trying to open?
I pinned a picture with error (in my first message). For example i tried to open google.com, btw this error happens in any page, that you try to open.
Hi Do you have an example of a page that you are trying to open?
Do you have any add-ons installed?
Do you use any security apps on your Android device?
Do you have any add-ons installed? Do you use any security apps on your Android device?
Yes, I have add-ons, but they were there even before I updated the application and everything was fine. By the way, I think they don’t work already, since the page in which the add-ons should be also shows the same error.
I only use VPN, but I’ve also used it before. Anyway, the first thing I tried was turning it off (although judging by error, these are unrelated things)
I tried to google this error but it seems my case is nowhere to be found.
By the way, other browsers work fine, like Chrome and, more importantly, Firefox Focus.
Also i have a question: If I reinstall the app, are my tabs would be saved in the cloud or deleted without a trace?
Do you have any add-ons installed? Do you use any security apps on your Android device?
Modified August 6, 2021 at 8:59:23 AM PDT by osigotx
Источник
XML Parsing Error: no root element found #5873
Comments
matthanley commented May 1, 2018
We’re seeing the error «XML Parsing Error: no root element found» and a 500 response when requesting files from public buckets with a read only policy on Docker builds after RELEASE.2018-04-19T22-54-58Z
Steps to Reproduce (for bugs)
- Existing data from a previous minio version
- Read only policy on public bucket
Following an update to a build later than RELEASE.2018-04-19T22-54-58Z we get a 500 response and the above error message. Build RELEASE.2018-04-19T22-54-58Z and earlier work correctly.
Context
Issue present following update to latest or edge
Your Environment
The text was updated successfully, but these errors were encountered:
harshavardhana commented May 1, 2018
Bucket policies are in JSON the error message seems to be different for XML? can you provide more details?
matthanley commented May 1, 2018
As an example we have a bucket called public with a * Read Only policy. Within this bucket, we have a plain text file containing only the characters OK that we use for monitoring availability.
We were also having an issue downloading files via mc from the same instance, with the error Unexpected EOF . I’ve reverted to the previous working release for now but if I have time over the next few days I’ll spin up the latest and edge builds and try and grab some relevant logs.
harshavardhana commented May 1, 2018
As an example we have a bucket called public with a * Read Only policy. Within this bucket, we have a plain text file containing only the characters OK that we use for monitoring availability.
This is not necessary you don’t need a complex setup like this to monitor Minio server availability we have moved to a more standardized approach here https://github.com/minio/minio/tree/master/docs/healthcheck — PTAL
We were also having an issue downloading files via mc from the same instance, with the error Unexpected EOF. I’ve reverted to the previous working release for now but if I have time over the next few days I’ll spin up the latest and edge builds and try and grab some relevant logs.
This would be interesting to see as well can you provide server, mc —debug logs as well?
matthanley commented May 1, 2018
No problem — I’ve just tested locally and it’s working so it might be something related to our infrastructure.
Thanks for the heads-up on the healthcheck endpoint, I’ll get our monitoring updated (we use the public bucket anyway)
Источник
Поэтому я делаю простое веб-приложение для входа / регистрации, но получаю следующую ошибку:
вот мой login.php
Я провел некоторое исследование об ошибках разбора XML, но мне все еще не удается заставить мой проект работать, я попробовал с Google Chrome и Firefox
Решение
АГА! Получил это сегодня по причине, которая заставит меня выглядеть довольно глупо, но который может быть однажды помогите кому-нибудь.
Настроив сервер Apache на моем компьютере, с PHP и так далее … Я получил эту ошибку … и затем понял, почему: я нажал на нужный HTML-файл (т. Е. Тот, который содержит Javascript / JQuery), поэтому в адресной строке браузера было показано «file: /// D: /apps/Apache24/htdocs/experiment/forms/index.html».
То, что вам нужно сделать, чтобы фактически использовать сервер Apache (при условии, что он работает и т. Д.), — это перейти «Http: //localhost/experiments/forms/index.html « в адресной строке браузера.
Для смягчения последствий я до сих пор использовал файл «index.php» и просто изменил на файл «index.html». Немного подвох, так как с первым вы должны получить к нему доступ «должным образом», используя localhost.
Другие решения
В Spring MVC Application возникла та же ситуация, что и в объявлении void, и изменив его на String, я решил проблему
Предполагая, что вы работаете с Javascript, вам нужно поместить заголовок перед отображением ваших данных:
Убедитесь, что ваш php-сервер работает и что php-код находится в соответствующей папке. Я столкнулся с этой же проблемой, если php не было там. Я также рекомендую поместить ваш html в ту же папку, чтобы предотвратить возникновение перекрестных ошибок при тестировании.
Если это не проблема, убедитесь, что каждый вызов SQL корректен в php, и что вы используете текущие стандарты php … Php меняется быстро, в отличие от html, css и Javascript, поэтому некоторые функции могут быть устаревшими.
Кроме того, я заметил, что вы, возможно, неправильно собираете свою переменную, что также может вызвать эту ошибку. Если вы отправляете переменные через форму, они должны быть в правильном формате и отправлены POST или GET, в зависимости от ваших предпочтений. Например, если бы у меня была страница входа в лабиринт:
HTML
JavaScript
PHP
Было бы полезно, если бы вы включили другие части кода, такие как HTML и JavaScript, так как мне не пришлось бы приводить свой собственный пример, подобный этому. Тем не менее, я надеюсь, что эти указатели помогут!
Источник
User1788249541 posted
Thanks for Reply,
Kindly find the below code.. Ple help to solve this issue.
function GetSearchMothDate(option, fromDate, ToDate) {
$.ajax({
type: «POST»,
data: «{‘Option’:’» + option + «‘,’fromDate’:’» + fromDate + «‘,’ToDate’:’» + ToDate + «‘}»,
url: «Grey_RollWise_Stock_Rpt.aspx/FinishedFabricStockDtl»,
dataType: «json»,
contentType: «application/json»,
success: function (data) {
data = data.d;
try {
$(«#jqGrid»).jqGrid().clearGridData();
$(«#gbox_jqGrid»).remove();
$(«#jqGrid»).remove();
$(«#jqGridPager»).remove();
}
catch (ex) {
}
$(«#grid»).append(«<table id=’jqGrid’ style=’width:100%;float:left;’></table>»);
$(«#grid»).append(«<div id=’jqGridPager’></div>»);
$(«#jqGrid»).jqGrid({
datatype: «local»,
colModel: [
//{ label: ‘S.No’, name: ‘SNO’, index: ‘SNO’, width: ’75px’, fixed: true, sortable: true, search: true, editable: false, align: ‘ceenter’ },
{ label: ‘OCN’, name: ‘OCNNo’, index: ‘OCNNo’, width: ‘120px’, fixed: true, sortable: true, search: true, editable: false, align: ‘left’, },
{ label: ‘Sort’, name: ‘SortCode’, index: ‘SortCode’, width: ‘100px’, fixed: true, sortable: true, search: true, editable: false, align: ‘left’ },
{ label: ‘Buyer’, name: ‘BuyerName’, index: ‘BuyerName’, width: ’60px’, fixed: true, sortable: true, search: true, editable: false, align: ‘left’ },
//{ label: ‘Shade’, name: ‘ColourName’, index: ‘ColourName’, width: ’90’, fixed: true, sortable: true, search: true, editable: false, align: ‘left’, },
{ label: ‘Design’, name: ‘designName’, index: ‘designName’, width: ‘175px’, fixed: true, sortable: true, search: true, editable: false, align: ‘left’, },
{ label: ‘Quality’, name: ‘QualityName’, index: ‘QualityName’, width: ‘100px’, fixed: true, sortable: true, search: true, editable: false, align: ‘left’ },
{ label: ‘Roll No’, name: ‘RollBaleNo’, index: ‘RollBaleNo’, width: ‘100px’, fixed: true, sortable: true, search: true, editable: false, align: ‘left’ },
//{ label: ‘Lot No’, name: ‘LotNo’, index: ‘LotNo’, width: ‘100px’, fixed: true, sortable: true, search: true, editable: false, align: ‘left’ },
{ label: ‘Meter’, name: ‘Meter’, index: ‘Meter’, width: ’85px’, fixed: true, sortable: true, search: true, editable: false, align: ‘right’ },
{ label: ‘Net Wt’, name: ‘NetWt’, index: ‘NetWt’, width: ’85px’, fixed: true, sortable: true, search: true, editable: false, align: ‘right’ },
{ label: ‘Gross Wt’, name: ‘GrossWt’, index: ‘GrossWt’, width: ’85px’, fixed: true, sortable: true, search: true, editable: false, align: ‘right’ },
{ label: ‘Location’, name: ‘Location’, index: ‘Location’, width: ‘100px’, fixed: true, sortable: true, search: true, editable: false, align: ‘left’ },
{ label: ‘Bin Location’, name: ‘BinLocation’, index: ‘BinLocation’, width: ‘100px’, fixed: true, sortable: true, search: true, editable: false, align: ‘left’ },
//{ label: ‘Lot No’, name: ‘NetWt’, index: ‘NetWt’, width: ‘300px’, fixed: true, sortable: true, search: true, editable: false, align: ‘right’ },
//{ label: ‘Price Per Unit ‘, name: ‘unitprice’, index: ‘unitprice’, width: ‘100px’, fixed: true, sortable: true, search: true, editable: false, align: ‘right’ },
//{ label: ‘Total Value’, name: ‘total’, index: ‘total’, width: ‘130px’, fixed: true, sortable: true, search: true, editable: false, align: ‘right’ },
],
data: JSON.parse(data),
rowno: 50,
loadonce: true,
rowList: [10000, 20000, 30000],
rowNum:10000,
pager: ‘#jqGridPager’,
viewrecords: true,
gridview: true,
sortorder: ‘asc’,
toppager: false,
cloneToTop: false,
altrows: false,
autowidth: false,
hoverrows: false,
shrinkToFit: true,
height: 450,
width: 1100,
rownumbers: false,
ignoreCase: true,
autoResizing: { compact: true },
iconSet: «fontAwesome»,
footerrow: true,
//rownumbers: true,
userDataOnFooter: true,
gridComplete: function () {
var $grid = $(‘#jqGrid’);
var OpenStockSum = $grid.jqGrid(‘getCol’, ‘total’, false, ‘sum’);
$grid.jqGrid(‘footerData’, ‘set’, { ‘total’: parseFloat(OpenStockSum).toFixed(3) });
var QtyStockSum = $grid.jqGrid(‘getCol’, ‘Meter’, false, ‘sum’);
$grid.jqGrid(‘footerData’, ‘set’, { ‘Meter’: parseFloat(QtyStockSum).toFixed(3) });
var QtyNetStockSum = $grid.jqGrid(‘getCol’, ‘NetWt’, false, ‘sum’);
$grid.jqGrid(‘footerData’, ‘set’, { ‘NetWt’: parseFloat(QtyNetStockSum).toFixed(3) });
var QtyGrossStockSum = $grid.jqGrid(‘getCol’, ‘GrossWt’, false, ‘sum’);
$grid.jqGrid(‘footerData’, ‘set’, { ‘GrossWt’: parseFloat(QtyGrossStockSum).toFixed(3) });
}
});
$(«#jqGrid»).jqGrid(‘filterToolbar’, { stringResult: true, searchOnEnter: false, autoSearch: true });
$(«#jqGrid»).jqGrid(‘navGrid’, «#jqGridPager», { search: false, edit: false, add: false, del: false, refresh: true }, {}, {}, {}, {});
$(‘#jqGrid’).jqGrid(‘navButtonAdd’, «#jqGridPager», { id: ‘ExportToExcel’, caption: ‘Excel’, title: ‘ExportToExcel’, onClickButton: function (e) { ExportDataToExcel(«#jqGrid», 1); }, buttonicon: ‘ui-icon-disk’ });
}
});
}
</script>
<script type=»text/javascript»>
function ExportJQGridDataToExcel(tableCtrl, excelFilename) {
// Export the data from our jqGrid into a (real !) Excel .xlsx file.
//
// We’ll build up a (very large?) tab-separated string containing the data to be exported, then POST them
// off to a .ashx handler, which creates the Excel file.
var allJQGridData = $(tableCtrl).jqGrid(‘getGridParam’, ‘data’);
var jqgridRowIDs = $(tableCtrl).getDataIDs(); // Fetch the RowIDs for this grid
var headerData = $(tableCtrl).getRowData(jqgridRowIDs[0]); // Fetch the list of «name» values in our colModel
// For each visible column in our jqGrid, fetch it’s Name, and it’s Header-Text value
var columnNames = new Array(); // The «name» values from our jqGrid colModel
var columnHeaders = new Array(); // The Header-Text, from the jqGrid «colNames» section
var inx = 0;
var allColumnNames = $(tableCtrl).jqGrid(‘getGridParam’, ‘colNames’);
// If our jqGrid has «MultiSelect» set to true, remove the first (checkbox) column, otherwise we’ll
// create an exception of: «A potentially dangerous Request.Form value was detected from the client.»
var bIsMultiSelect = $(tableCtrl).jqGrid(‘getGridParam’, ‘multiselect’);
if (bIsMultiSelect) {
allColumnNames.splice(0, 1);
}
for (var headerValue in headerData) {
// If this column ISN’T hidden, and DOES have a column-name, then we’ll export its data to Excel.
var isColumnHidden = $(tableCtrl).jqGrid(«getColProp», headerValue).hidden;
if (!isColumnHidden && headerValue != null) {
columnNames.push(headerValue);
columnHeaders.push(allColumnNames[inx]);
}
inx++;
}
// We now need to build up a (potentially very long) tab-separated string containing all of the data (and a header row)
// which we’ll want to export to Excel.
// First, let’s append the header row…
var excelData = »;
for (var k = 0; k < columnNames.length; k++) {
excelData += columnHeaders[k] + «t»;
}
excelData = removeLastChar(excelData) + «rn»;
// ..then each row of data to be exported.
var cellValue = »;
for (i = 0; i < allJQGridData.length; i++) {
var data = allJQGridData[i];
for (var j = 0; j < columnNames.length; j++) {
// Fetch one jqGrid cell’s data, but make sure it’s a string
cellValue = » + data[columnNames[j]];
if (cellValue == null)
excelData += «t»;
else {
if (cellValue.indexOf(«a href») > -1) {
// Some of my cells have a jqGrid cell with a formatter in them, making them hyperlinks.
// We don’t want to export the «<a href..> </a>» tags to our Excel file, just the cell’s text.
cellValue = $(cellValue).text();
}
// Make sure we are able to POST data containing apostrophes in it
cellValue = cellValue.replace(/’/g, «'»);
excelData += cellValue + «t»;
}
}
excelData = removeLastChar(excelData) + «rn»;
}
// Now, we need to POST our Excel Data to our .ashx file *and* redirect to the .ashx file.<a href=»../Handlers/ExportGridToExcel.ashx»>../Handlers/ExportGridToExcel.ashx</a>
postAndRedirect(«../Handlers/ExportGridToExcel.ashx?filename=» + excelFilename, { excelData: excelData, searchData: $(tableCtrl).jqGrid(‘getGridParam’, ‘postData’).filters });
}
function removeLastChar(str) {
// Remove the last character from a string
return str.substring(0, str.length — 1);
}
function postAndRedirect(url, postData) {
// Redirect to a URL, and POST some data to it.
// Taken from:
// http://stackoverflow.com/questions/8389646/send-post-data-on-redirect-with-javascript-jquery
//
var postFormStr = «<form method=’POST’ action=’» + url + «‘>n»;
for (var key in postData) {
if (postData.hasOwnProperty(key)) {
postFormStr += «<input type=’hidden’ name=’» + key + «‘ value=’» + postData[key] + «‘></input>»;
}
}
postFormStr += «</form>»;
var formElement = $(postFormStr);
$(‘body’).append(formElement);
$(formElement).submit();
}
function ExportDataToExcel(tableCtrl, Id) {
// Export the data from our jqGrid into a «real» Excel 2007 file
if (Id == 1) {
ExportJQGridDataToExcel(tableCtrl, «GreyRollWiseStock.xlsx»);
}
}
Поэтому я делаю простое веб-приложение для входа / регистрации, но получаю следующую ошибку:
XML Parsing Error: no root element found Location: file:///C:/xampp/htdocs/EdgarSerna95_Lab/login.html Line Number 37, Column 3:
а также
XML Parsing Error: no root element found Location: file:///C:/xampp/htdocs/EdgarSerna95_Lab/php/login.phpLine Number 37, Column 3:
вот мой login.php
<?php
header('Content-type: application/json');
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "jammer";
// Create connection
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
header('HTTP/1.1 500 Bad connection to Database');
die("The server is down, we couldn't establish the DB connection");
}
else {
$conn ->set_charset('utf8_general_ci');
$userName = $_POST['username'];
$userPassword = $_POST['userPassword'];
$sql = "SELECT username, firstName, lastName FROM users WHERE username = '$userName' AND password = '$userPassword'";
$result = $conn->query($sql);
if ($result->num_rows > 0) {
while($row = $result->fetch_assoc()) {
$response = array('firstName' => $row['firstNameName'], 'lastName' => $row['lastName']);
}
echo json_encode($response);
}
else {
header('HTTP/1.1 406 User not found');
die("Wrong credentials provided!");
}
}
$conn->close();
?>
Я провел некоторое исследование об ошибках разбора XML, но мне все еще не удается заставить мой проект работать, я попробовал с Google Chrome и Firefox
3
Решение
АГА! Получил это сегодня по причине, которая заставит меня выглядеть довольно глупо, но который может быть однажды помогите кому-нибудь.
Настроив сервер Apache на моем компьютере, с PHP и так далее … Я получил эту ошибку … и затем понял, почему: я нажал на нужный HTML-файл (т. Е. Тот, который содержит Javascript / JQuery), поэтому в адресной строке браузера было показано «file: /// D: /apps/Apache24/htdocs/experiment/forms/index.html».
То, что вам нужно сделать, чтобы фактически использовать сервер Apache (при условии, что он работает и т. Д.), — это перейти «Http: //localhost/experiments/forms/index.html« в адресной строке браузера.
Для смягчения последствий я до сих пор использовал файл «index.php» и просто изменил на файл «index.html». Немного подвох, так как с первым вы должны получить к нему доступ «должным образом», используя localhost.
7
Другие решения
В Spring MVC Application возникла та же ситуация, что и в объявлении void, и изменив его на String, я решил проблему
@PostMapping()
public void aPostMethod(@RequestBody( required = false) String body) throws IOException {
System.out.println("DoSome thing" + body);
}
к
@PostMapping()
public String aPostMethod(@RequestBody( required = false) String body) throws IOException {
System.out.println("DoSome thing" + body);
return "justReturn something";
}
3
Предполагая, что вы работаете с Javascript, вам нужно поместить заголовок перед отображением ваших данных:
header('Content-Type: application/json');
echo json_encode($response);
0
Убедитесь, что ваш php-сервер работает и что php-код находится в соответствующей папке. Я столкнулся с этой же проблемой, если php не было там. Я также рекомендую поместить ваш html в ту же папку, чтобы предотвратить возникновение перекрестных ошибок при тестировании.
Если это не проблема, убедитесь, что каждый вызов SQL корректен в php, и что вы используете текущие стандарты php … Php меняется быстро, в отличие от html, css и Javascript, поэтому некоторые функции могут быть устаревшими.
Кроме того, я заметил, что вы, возможно, неправильно собираете свою переменную, что также может вызвать эту ошибку. Если вы отправляете переменные через форму, они должны быть в правильном формате и отправлены POST или GET, в зависимости от ваших предпочтений. Например, если бы у меня была страница входа в лабиринт:
HTML
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
<form class="modal-content animate" method="post">
<div class="container">
<label><b>Username</b></label>
<input type="text" id="usernameinput" placeholder="Enter username" name="uname" required>
<label><b>Password</b></label>
<input type="password" id="passwordinput" placeholder="Enter Password" name="psw" required>
<button onclick="document.getElementById('id01').style.display='block'">Sign Up</button>
<button type="button" id="loginsubmit" onclick="myLogin(document.getElementById('usernameinput').value, document.getElementById('passwordinput').value)">Login</button>
</div>
</form>
JavaScript
function myLogin(username, password){
var datasend=("user="+username+"&pwd="+password);
$.ajax({
url: 'makeUserEntry.php',
type: 'POST',
data: datasend,
success: function(response, status) {
if(response=="Username or Password did not match"){
alert("Username or Password did not match");
}
if(response=="Connection Failure"){
alert("Connection Failure");
}
else{
localStorage.userid = response;
window.location.href = "./maze.html"}
},
error: function(xhr, desc, err) {
console.log(xhr);
console.log("Details: " + desc + "\nError:" + err);
var response = xhr.responseText;
console.log(response);
var statusMessage = xhr.status + ' ' + xhr.statusText;
var message = 'Query failed, php script returned this status: ';
var message = message + statusMessage + ' response: ' + response;
alert(message);
}
}); // end ajax call
}
PHP
<?php
$MazeUser=$_POST['user'];
$MazePass=$_POST['pwd'];//Connect to DB
$servername="127.0.0.1";
$username="root";
$password="password";
$dbname="infinitymaze";
//Create Connection
$conn = new MySQLi($servername, $username, $password, $dbname);
//Check connetion
if ($conn->connect_error){
die("Connection Failed: " . $conn->connect_error);
echo json_encode("Connection Failure");
}
$verifyUPmatchSQL=("SELECT * FROM mazeusers WHERE username LIKE '$MazeUser' and password LIKE '$MazePass'");
$result = $conn->query($verifyUPmatchSQL);
$num_rows = $result->num_rows;
if($num_rows>0){
$userIDSQL =("SELECT mazeuserid FROM mazeusers WHERE username LIKE '$MazeUser' and password LIKE '$MazePass'");
$userID = $conn->query($userIDSQL);
echo json_encode($userID);
}
else{
echo json_encode("Username or Password did not match");
}
$conn->close();
?>
Было бы полезно, если бы вы включили другие части кода, такие как HTML и JavaScript, так как мне не пришлось бы приводить свой собственный пример, подобный этому. Тем не менее, я надеюсь, что эти указатели помогут!
0
у меня приходит от клиента запрос на удаления пакета id (то есть удаление нескольких записей в базе данных).
rest endpoint
Java | ||
|
dto
Java | ||
|
метод сервиса занимается обработкой задачи
Java | ||
|
маппер четко без ошибок преобразует long в string и обратно.
Java | ||
|
Запрос обрабатывается и я получаю от сервера ответ 200 если пользуюсь для отладки Postman.
Когда я использую для удаления выбранных строк браузер, то ответ сначала получаю 200.
Javascript | ||
|
но во время работы с Ajax , когда отработает свойство success, данные запрашиваются и спокойно снова рисуется таблица.
Но в этот момент появляется ошибка
переход по ссылке показывает json , который отправлен сервером
Javascript | ||
|
как эту ошибку можно исправить и что это такое