Skip to content
Advertisement

Create an XML file in server using SimpleXML and jQuery Ajax

What I want to do surely can be accomplished but I’m doing something wrong: I want to create an XML file when I use an Ajax call. I got the following code (synthesized). Maybe this example doesn’t work, it’s just to exemplify:

HTML

JavaScript

PHP in server

JavaScript

In this example the PHP code works as is, the other one not. But in the whole context of my code, the Ajax call works, I have no doubt as it does everything else it must to just the creation of the XML code doesn’t. Having the very same PHP code as here, if I do the Ajax call the file it’s not created. If in a console I do

JavaScript

The XML file it’s created successfully. So it’s not the PHP code and at the same time it’s not an error in my Ajax call because it does everything it should. What could be happening?

Edit

In my real code, in the PHP file in the server I do this:

JavaScript

That createXML() function contains my previous code.

Advertisement

Answer

I’m so ashamed u.u The code I got was working good, but the folder where to write the file had no permissions for the user =/ I’m sorry… I double checked this, however even with a chmod 777 I couldn’t do it. It was an issue in the permissions with the group of the user… Sorry and thanks for helping me. Change permissions to the folder in Linux

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement