souravhainpagal Posted September 5, 2012 Share Posted September 5, 2012 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 !!! Quote Link to comment https://forums.phpfreaks.com/topic/268033-send-xml-on-to-the-client-side-as-a-xml-file/ Share on other sites More sharing options...
Jessica Posted September 5, 2012 Share Posted September 5, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/268033-send-xml-on-to-the-client-side-as-a-xml-file/#findComment-1375550 Share on other sites More sharing options...
souravhainpagal Posted September 5, 2012 Author Share Posted September 5, 2012 okay sorry... i thought the query forms a part of both the forums so posted twice... i will remove one ASAP thank you Quote Link to comment https://forums.phpfreaks.com/topic/268033-send-xml-on-to-the-client-side-as-a-xml-file/#findComment-1375555 Share on other sites More sharing options...
Maq Posted September 5, 2012 Share Posted September 5, 2012 okay sorry... i thought the query forms a part of both the forums so posted twice... i will remove one ASAP thank you I deleted your other topic, as jesi mentioned, don't double post. Quote Link to comment https://forums.phpfreaks.com/topic/268033-send-xml-on-to-the-client-side-as-a-xml-file/#findComment-1375566 Share on other sites More sharing options...
ignace Posted September 5, 2012 Share Posted September 5, 2012 Ajax: Using jQuery: $.get("path/to/xmlfile.xml", function(xml) { console.dir(xml); }, 'xml'); Quote Link to comment https://forums.phpfreaks.com/topic/268033-send-xml-on-to-the-client-side-as-a-xml-file/#findComment-1375567 Share on other sites More sharing options...
souravhainpagal Posted September 5, 2012 Author Share Posted September 5, 2012 @ ignace please clarify your answer which part of my problem does your answer solve ? Quote Link to comment https://forums.phpfreaks.com/topic/268033-send-xml-on-to-the-client-side-as-a-xml-file/#findComment-1375570 Share on other sites More sharing options...
ignace Posted September 6, 2012 Share Posted September 6, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/268033-send-xml-on-to-the-client-side-as-a-xml-file/#findComment-1375669 Share on other sites More sharing options...
souravhainpagal Posted September 6, 2012 Author Share Posted September 6, 2012 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 ? Quote Link to comment https://forums.phpfreaks.com/topic/268033-send-xml-on-to-the-client-side-as-a-xml-file/#findComment-1375676 Share on other sites More sharing options...
Christian F. Posted September 6, 2012 Share Posted September 6, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/268033-send-xml-on-to-the-client-side-as-a-xml-file/#findComment-1375677 Share on other sites More sharing options...
ignace Posted September 6, 2012 Share Posted September 6, 2012 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. Quote Link to comment https://forums.phpfreaks.com/topic/268033-send-xml-on-to-the-client-side-as-a-xml-file/#findComment-1375678 Share on other sites More sharing options...
souravhainpagal Posted September 6, 2012 Author Share Posted September 6, 2012 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 Quote Link to comment https://forums.phpfreaks.com/topic/268033-send-xml-on-to-the-client-side-as-a-xml-file/#findComment-1375801 Share on other sites More sharing options...
Jessica Posted September 6, 2012 Share Posted September 6, 2012 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? Quote Link to comment https://forums.phpfreaks.com/topic/268033-send-xml-on-to-the-client-side-as-a-xml-file/#findComment-1375802 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.