Jump to content

Recommended Posts

I have written a php script that prepares an XML and saves it onto the server itself...but I need the php to send the XML on to the client side...

Then I have a HTML file which will call a javascript function using the XML file as its parameter...

It is working fine if the XML is in the server...

BUT i dont know how to load an XML file from the client side itself...i.e. a local file...

 

Two problems :

 

1. Make the XML using data from the server side (No issues)...then SEND the xml to the client side using PHP (issue)

2. Use that same xml file sent to the client side...to call a javascript function from within an HTML file

 

An explanatory reply will be well appreciated !!!

Please don't double post. When you signed up here you agreed to follow the rules. http://www.phpfreaks.com/page/rules-and-terms-of-service

If no one has responded yet either no one who can help with your specific problem is around, or no one understood the question.

Oops misunderstood your question. Why don't you just let the user upload the file? Otherwise you'll have to reference it through file:/// but then it'll have to be at an exact location and the client must allow it.

i dont want there to be any change on the server side...i dont want to save anything on the server side

the user enters certain form data and then the server side php prepares an XML...

 

i want that xml to be sent to the client side and then another page will use that XML to display the data...

 

can it be done ?

And how does that page "display the data"? I'm talking about how the code, not the design, btw.

 

The biggest question, however, is why you're dead set on making things more difficult than they have to be? Why not just have the server-side code generate the result page straight away, save the file temporarily, or just save the raw input data in a database?

i want that xml to be sent to the client side and then another page will use that XML to display the data...

 

Back to my original answer:

 

Ajax:

 

Using jQuery:

$.get("path/to/generate/my/xml.php", function(xml) {
  console.dir(xml);
  // use it however you would like..
}, 'xml');

 

Or use XSLT. If this is not what you want then you are gonna have to clarify yourself properly.

And how does that page "display the data"? I'm talking about how the code, not the design, btw.

 

The biggest question, however, is why you're dead set on making things more difficult than they have to be? Why not just have the server-side code generate the result page straight away, save the file temporarily, or just save the raw input data in a database?

 

I want to do what you said exactly...

I want the php to prepare the XML and save the file temporarily...(BUT NOT IN THE SERVER)...temporary storage would do

I want the php to prepare the XML and save the file temporarily...(BUT NOT IN THE SERVER)...temporary storage would do

 

You would have to have the browser force a download of the file. Then if you want your site to be able to use it again, the user would have to upload it.

 

Why are you trying to do it this way?

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.