3

My web app is working on local and not online

🀯😲😲😲😲

How is it possible?

AJAX Call not working.
Not sending data😟

Comments
  • 11
    CORS?
  • 2
    @stop what do you mean?
  • 3
    Cross-Origin Resource Sharing. If your content is on another domain, you get errors, because the browser blocks connections. You can see it in the console of the browser.
  • 5
  • 2
    Give us an error and we might be able to help properly :)
  • 5
    Local is using 127.0.0.1/someFile.ext

    And online is using 127.0.0.1/someFile.ext

    I've done this before πŸ˜‚

    Seriously give us some errors - open console and go digging.
  • 1
    @M1sf3t working from home has its drawbacks. 🀨 wait... did I just find a human?
  • 1
    @C0D4 one query is failing online

    But the connection to the database is fine
  • 1
    @Afrographics

    Can you run the query directly against the db - not through php?

    Does the result actually have any records?

    Are you actually giving mysqli_query() the db connection in the arguments?

    mysqli_num_rows( $result );

    Or are you using prepared statements?

    So much could be going on without seeing the actual code.
  • 0
    @C0D4 thanks dude

    But i think i figured out what is going on

    Actually i'm testing my chat application by using a free hosting service.

    And i commit to refresh the messages every 2 seconds. What is probably a lot load on the server

    And since the hosting is free i'm probably limited. So my database is crashing)
  • 0
    @Afrographics Better to use socket.io
    Refresh based chat is so so 15 years old. You won't regret using sockets.
  • 0
    @themissingbrace it is supported by all hosting services?
  • 0
    @Afrographics You'll need a relay, which is often a separate service although it can be done over http. 0000webhost gives you a single apache vhost and a database on a shared MySQL instance. So either you use a different service for relaying or you use long-polling and the server waits for messages on, again, some kind of relay, although this time it could be an IPC-based relay. Now, I don't know about their security measures, but I feel like you don't have access to in-memory shared filesystem (/tmp) and you don't have exec() so you can't create a socket or something.
Add Comment