XML parsing error: no root element found location:

Problems with the Mac OS X version of XAMPP, questions, comments, and anything related.

XML parsing error: no root element found location:

Postby kgw » 09. April 2017 06:23

Had an http/php/js application that was working.

For no reason I can see the application stopped working

get error XML Parsing Error: no root element foundLocation: file:///A.... (file location)
error line 37, column 3.

This is the end of the file.

<?php
ini_set("error_reporting",E_ALL);
ini_set("log_errors","1");
ini_set("error_log","php_errors.txt");
$conn=mysqli_connect("127.0.0.1","root","password","333_A2");
$town=$_GET["town"];
if($town=="all")
{
$query="select * from weather";
}
else
{
$query="select * from weather where `town` ='".$town."'";
}
$result = mysqli_query($conn,$query);
$jsonResult= array();
while($row=mysqli_fetch_assoc($result))
{
$jsonResult[]=$row;
}
mysqli_close($conn);

$jsonToGo = json_encode($jsonResult);
echo $jsonToGo;
?> (This is line 37)

In safari and Chrome returns readystate 4, status 0.
In firefox developer it returns readystate 4, status 4. but the response text is the above php file not the request.

I was working on some dom element construction that I did not think had caused the problem, but loaded a previous working version anyway. Still had the same problem.
Have stopped servers, shutdown and restarted computer.

this is the ajax request

function ajaxRequest(method, url, sync, data, callback){

var request = new XMLHttpRequest();
request.open(method,url,sync);

if(method == "POST"){
request.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
}
request.onreadystatechange = function(){
if (request.readyState == 4) {
if (request.status == 200) {
var response = JSON.parse(this.responseText);
callback(response);
} else {
alert("AJAX REQUEST GONE BAD");
}
}
}
request.send(data);
}

have searched the net and am at a loss.
any help appreciated.
Kelly
kgw
 
Posts: 2
Joined: 09. April 2017 06:00
XAMPP version: 5.6.24-1
Operating System: MacOS Sierra ver 10.12.4

Re: XML parsing error: no root element found location:

Postby kgw » 09. April 2017 21:22

Without changing any code this is now working.

Unsure what the problem was.
kgw
 
Posts: 2
Joined: 09. April 2017 06:00
XAMPP version: 5.6.24-1
Operating System: MacOS Sierra ver 10.12.4


Return to XAMPP for macOS

Who is online

Users browsing this forum: No registered users and 88 guests