Jquery URL

I have URL with jquery and I don't want anyone to xml on the web. What is my option?
LVL 1
ITsolutionWizardAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Leonidas DosasCommented:
What do you mean?Could you post an example?
ITsolutionWizardAuthor Commented:
function fnGetBondNameList(bondState) {
        $.ajax({
            url: "http://localhost:5489/BondList.xml",
            success: function (xml) {
                parseSelectXML(xml,"bondName","Bond",bondState)
            },
            error: function (xhr, ajaxOptions, thrownError) {
                alert("Status: " + xhr.status);
                alert("Error: " + thrownError);
            }
        });
    }
Chris StanyonWebDevCommented:
You could potentially mask the URL by creating a middle-ware script, but the nature of your script means that any user would be able to see the URL that you're posting your AJAX request to. To do this, you could create a file, such as getScript.php and point your AJAX to that. Code the php script to then pull in the XML from a URL and then deliver that content. While this would mask the URL of your actual XML file, it won't mask the URL of the getScript.php file, so it may not make sense to do that.

The fact that your script needs to get it's info from somewhere means that somewhere must be publicly accessible, and therefore viewable by the end user.

Maybe you could explain the thinking behind your requirements and we might be able to offer other suggestions. As it stands at the moment, your script needs to load in the data, so anyone can view that data (even if they just use the webdev tools available in all modern browsers)

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ITsolutionWizardAuthor Commented:
Just show me in codes and maybe i can understand more what you mean. Thanks
Chris StanyonWebDevCommented:
//getScript.php
<?php
include('path/to/your/file.xml')

Open in new window

And then in your Ajax call:

url: 'getScript.php',

As I said, this won't stop people from being to load your XML file - that's not going to be possible because your page needs to be able to read it, so any user can also read it - that's just the way it works!!
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
HTML

From novice to tech pro — start learning today.