pastebin

0 favourites
  • 10 posts
  • hello, in a game I'm developing I'm creating events and these events will be activated only when a certain value is at 1, but when I ask for ajax nothing happens I can't get this value from pastebin, what's wrong?

  • CORS problem.

    Hit F12 and go to console.

    Hit your button.

  • CORS problem.

    Hit F12 and go to console.

    Hit your button.

    Here it is

    bootPreview.js:92 Registered service worker on preview.construct.net

    sw.js:562 [SW-Preview] Up to date

    runtime.js:21 [C3 runtime] Hosted in DOM, rendering with WebGL 2 [ANGLE (Google, Vulkan 1.2.0 (SwiftShader Device (Subzero) (0x0000C0DE)), SwiftShader driver)] (standard compositing)

    local.html:1 Access to XMLHttpRequest at 'https://pastebin.com/raw/BwFuiN0G' from origin 'https://preview.construct.net' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.

    instance.js:3 [Construct 3] AJAX request to 'https://pastebin.com/raw/BwFuiN0G' (tag 'event') failed: ProgressEvent {isTrusted: true, lengthComputable: false, loaded: 0, total: 0, type: 'error', …}isTrusted: truebubbles: falsecancelBubble: falsecancelable: falsecomposed: falsecurrentTarget: XMLHttpRequest {readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, onreadystatechange: ƒ, …}defaultPrevented: falseeventPhase: 0lengthComputable: falseloaded: 0path: []returnValue: truesrcElement: XMLHttpRequest {readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, onreadystatechange: ƒ, …}target: XMLHttpRequest {readyState: 4, timeout: 0, withCredentials: false, upload: XMLHttpRequestUpload, onreadystatechange: ƒ, …}timeStamp: 8868total: 0type: "error"[[Prototype]]: ProgressEvent

    _TriggerError instance.js:3

    _OnError instance.js:4

    errorFunc instance.js:6

    error (async)

    (anonymous) instance.js:7

    _DoRequest instance.js:6

    Request actions.js:2

    _RunActions_ReturnValue eventBlock.js:27

    _RunAndBlock eventBlock.js:24

    Run eventBlock.js:21

    _ExecuteTrigger eventSheet.js:19

    _TriggerForClass eventSheet.js:13

    _Trigger eventSheet.js:12

    _Trigger eventSheetManager.js:13

    Trigger runtime.js:89

    TriggerAsync runtime.js:90

    TriggerAsync sdkInstanceBase.js:4

    _OnClick instance.js:3

    (anonymous) plugin.js:1

    (anonymous) sdkDOMPluginBase.js:3

    _OnEventFromDOM runtime.js:16

    _OnMessageFromDOM runtime.js:14

    _PostToRuntimeMaybeSync domHandler.js:2

    _PostToRuntimeElementMaybeSync domElementHandler.js:4

    (anonymous) domSide.js:3

    instance.js:9 GET pastebin.com/raw/BwFuiN0G net::ERR_FAILED 200

    (anonymous) instance.js:9

    _DoRequest instance.js:6

    Request actions.js:2

    _RunActions_ReturnValue eventBlock.js:27

    _RunAndBlock eventBlock.js:24

    Run eventBlock.js:21

    _ExecuteTrigger eventSheet.js:19

    _TriggerForClass eventSheet.js:13

    _Trigger eventSheet.js:12

    _Trigger eventSheetManager.js:13

    Trigger runtime.js:89

    TriggerAsync runtime.js:90

    TriggerAsync sdkInstanceBase.js:4

    _OnClick instance.js:3

    (anonymous) plugin.js:1

    (anonymous) sdkDOMPluginBase.js:3

    _OnEventFromDOM runtime.js:16

    _OnMessageFromDOM runtime.js:14

    _PostToRuntimeMaybeSync domHandler.js:2

    _PostToRuntimeElementMaybeSync domElementHandler.js:4

    (anonymous) domSide.js:3

  • CORS is a very common problem, try searching this forum for solutions. You may need to export your game and upload to a website to test.

  • Unless pastebin allows CORS you're out of luck, and it looks like it doesn't. You'll have to find a different place to store your data, could be as simple as a textfile on your own website where you can allow CORS.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I used pastebin in Construct 2 project without any issues. I think the problem is with preview, it should work in the exported game.

  • I used pastebin in Construct 2 project without any issues. I think the problem is with preview, it should work in the exported game.

    actually it doesn't work with the exported game either, I published an android version in the play story and it didn't work either

  • Unless pastebin allows CORS you're out of luck, and it looks like it doesn't. You'll have to find a different place to store your data, could be as simple as a textfile on your own website where you can allow CORS.

    the only site I can have so far is a google blogger, could you teach me how to create a text file and how to loberar cors there?

  • There are CORS proxies you can try. For example, this URL works for me even in preview:

    https://api.allorigins.win/raw?url=https://pastebin.com/raw/NC33t4ZB

    (I don't know if there may be any problems with using this proxy site)

  • Same problem, used the proxy listed above and worked perfectly. I had to put a small delay in my loader to load the version correctly, but it works great.

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