How do I can read a external JSON or XML file?

0 favourites
From the Asset Store
Source File, music and art pack for Android Negotiator
  • Your choice not mine. If one wants to learn he or she would do anything. In your case sorry no comment

    Maybe they want to learn, just not able to explain themselves in a way we can understand...

    (I used to work with the special ed students in highschool. I know plently about lack of ways to express oneself.

    not saying he is special ed, but English may not be his native language. As well, there are certain terms used in game development and even in Construct 2, that may not be easy to express or readily understandable. )

    Flat out telling a person that you give up on them, and or they don't want to learn, when they are showing a simple lack of understanding/expression of words is degrading and rude. And really hurts one's spirit.

  • Yes i've read but it's usless.

    I don't want download file from the website.

    He means he doesn't want to download the json file from that website. He wants to be able to read the link to it from inside C2 using Ajax.

  • > Your choice not mine. If one wants to learn he or she would do anything. In your case sorry no comment

    >

    Maybe they want to learn, just not able to explain themselves in a way we can understand...

    (I used to work with the special ed students in highschool. I know plently about lack of ways to express oneself.

    not saying he is special ed, but English may not be his native language. As well, there are certain terms used in game development and even in Construct 2, that may not be easy to express or readily understandable. )

    Flat out telling a person that you give up on them, and or they don't want to learn, when they are showing a simple lack of understanding/expression of words is degrading and rude. And really hurts one's spirit.

    +1

  • Jermfire yes I do understand. If you read my bio you will know I was teacher since 1986. I was teaching IT for UK-ONLINE Government run program. I have come across these type of people many times. They want something for nothing. Jermfire there for please do not lecture me. I have seen more christmas then you had hot dinners Jermfire. Thanks for advise and Jermfire if you feel like you can help these type of people in future do so. You seems to me more understanding than this oldman. Bless you Jermfire

  • blackcrypt thanks for your advise you and Jermfire can open school for these type of people or make yourself website where they can come and ask for your advise then come on C2 forum. That way you would not need to give this advise to oldman like this. Whom has seen more troubled in life then you lot done in your life.Bless you blackcrypt

  • [quote:2gmapz3m]I have seen more christmas then you had hot dinners ..

    My opinion is done and I want change my opinion that easy. I have seen and experience with both kind of "characters", but to 99% it's: "Do it, this is a forum. I command it, community, make me the new Zuckerberg"

    But I prefer to close this thread or start a new one somewhere else about "ethic".

  • I have seen several people tell information seekers that they can't expect someone to 'do it for them' - You are giving your opinion and expecting everyone else to follow along - some people might well be quite happy to throw a little example capx together. This is a community forum, the OP is quite within reason to ask if someone would be willing to do that for them. If you don't want to do that then don't.

    Shiva - I too have seen many Christmases. Your age and mine is irrelevant - You don't get extra kudos for being old.

  • I did not ask for one and never will

  • I think what he is having trouble with, is getting the game to read a json or xml file from an external server(url). An issue I was having as well at one point. By default, browsers are set to block those request, so you have to give that permission manually.

    I think this is what your after? Copied from tutorial.

    Making AJAX requests cross-domain or in preview

    By default, browsers block AJAX requests across domains. This means, for example, a game on scirra.com can request other pages on scirra.com, but cannot request pages on facebook.com. This is an important security feature of web browsers (it is not specific to Construct 2 or its AJAX object).

    Also, when previewing in Construct 2 the game runs on localhost. This counts as a different domain to the rest of the internet, so typically AJAX requests to any web page will fail during preview, unless the server explicitly allows cross-domain requests.

    *** (this part is the trouble. Lack of explanation here down)****

    If you want AJAX requests to your server to work from any domain, or in preview, you can configure it to send the following HTTP header:

    Access-Control-Allow-Origin: *

    This will enable AJAX requests from any domain, but you should still be aware of the possible security implications of this. For more information on cross-domain requests see HTTP access control on MDN.

    Thx so much for all!!

  • I did not ask for one and never will

    I did not say that you did. There is nothing wrong with asking though.

  • that's true but one must understand one has already given one answer therefore one must know one must do. I gave him something to read I did not asked him to download anything

  • that's true but one must understand one has already given one answer therefore one must know one must do. I gave him something to read I did not asked him to download anything

    If you notice, He responded to my answer positively in an understanding way. I didn't do the work for him. I didn't give him anything, but point out a simple location that actually has to be further researched if you don't know anything about configuring http headers. So He is still doing the work himself, but is now guided in the right direction.

    You still seem to misunderstand his post. He wasn't referring to you giving him something to download.

    He is saying he doesn't want to download the file in his original question. He wants to know how to link to it.

    Do you, or do you not know how to get C2 to read a file from an external website without downloading?

    That is the whole question. Yes, we all including op know how to add an xml from our harddrive into the "files" folder and get Ajax to read from it. The original tutorial that everybody always links to doesn't address op's problem directly.

    What the question is: How can I get Ajax to call up Http://www.somewebsite.com/folder/iwantthis.xml and read from it.

    Did I break it down enough?

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I have seen more christmas then you had hot dinners Jermfire.

    As far as I can remember, I have had a hot dinner, every day of my life. Wait. 365 days in a year so...

    365 x 29 = 10,585. So you've seen over 10,585 Christmases?? Dude. Are you Moses?

    lol jk. had to pick at ya on that one.

  • This is gone way out of hands. Let me put truce and say ok boys you win and this oldman lost. Will that satisfy you if yes then so be it. No more on this subject. I am not shamed to say I have put end to it. God Bless you all

  • This is exactly the problem I am having trying to retrieve an XML file from my website. I can find no example of how to follow this instruction.

    ----------------------------------- from the manual -----------------------------------------------

    If you want AJAX requests to your server to work from any domain, or in preview, you can configure it to send the following HTTP header:

    Access-Control-Allow-Origin: *

    --------------------------------------

    I tried sending a header using the AJAX send header action with the following values

    Header: "Access-Control-Allow-Origin:" Value: "*"

    Then followed it with an AJAX request url action. No luck. any suggestions?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)