Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm trying to make a web application which uses a mobile phone as a controller (an example of this kind of thing: http://chrome.com/supersyncsports/). It isn't something very complicated, I just need to send text which was entered in the phone to the computer. I don't need any database, I just need to send text from one device to another. Is there a way to do this with AJAX and without PHP?
Thanks,
bhc11
This is possible but it's not simple. You will need to setup a browser-to-browser peer-to-peer connection.
See WebRTC and Wikipedia for a high overview of the technology.
You are going to need some server back-end to process this. You will make your ajax call to the server which reads and determines the location to send the text on to. Since you are using mobile, you will need to either send a push notification to the second user, or you need to have the users polling for new content.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
Title says it all... I'm new to coding and I just want as simple as an answer as it can be. I have a weather api, but it is limited on calls each refresh acts as a call, but the forecast updates daily. Anyway around this to maximize my calls? I can post my js code and html if necessary.
You have two ways. Either you create a database and save all of the data there and retrieve it back when you want to. Or if the data you have is not that much and you don't want to deal with databases, then you write the json string to a text file in the memory card and read it later when you are offline.
And for the second case, every time you go online, you can retrieve the same json from your web service and over write it to the old one. This way you can be sure that you have the latest json saved to the device.
Use a file to store the API response for the day in server and call
the api only once per day(it depends on you how accurate weather
details to be shown. twice/ thrice it up to you ).
Saving a text file on server using JavaScript
or you can use any server side language.
Store the API details in server database and run the API only once
a day using a cron file.
https://www.setcronjob.com/
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am building a web browser text base RPG game with PHP/Javascript/HTML and CSS.
Each user has some information like his Name, Level, Experience, Gold and more. All the data is saved in the database.
When moving from pages in the game what will be the right method to store the data to be use in all the pages?
I thought about the following options:
PHP SESSION
Cookie
Using GET with the info in the link.
What do you think is the right way to do it?
In aspect of data security, hacking, easy etc.
Currently I am thinking about using PHP SESSION.
Assuming that most of your game logic is executed on the server side, keep the game state in the PHP session. Other than cookies and GET parameters, the session information is stored on server side and for this reason out of reach for manipulations by the user.
In addition to that, save consistent states to the database often to make the game information persistent.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 6 years ago.
Improve this question
I'm starting a project that will use a search bar to hit a web api and return the results. There will be no writing to the web api.
My biggest struggle when creating a new project is how it should be laid out. I never know when i should create a DAO, do it all via javascript, put it in a controller, etc.
For developing something like a search engine or any web application. You would need following:
A frontend, which is your application's GUI in browser of user or mobile application.
A backend logic, this could be in any server side scripting language, in your case you would be writing server code in .net
Now, your backend must expose a search api, Eg. If I send a HTTP GET with a variable q, it should return search results matching the query.
Your frontend must have input-box and a button for allowing users to send this request.
This answer isn't complete, just a vague overview of how this problem can be approached, also this isn't the only solution.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
I am making my own website and I've never really done it before. I am familiar with each of the separate parts, but I've never put them all together before.
I want to have html and javascript on the front end. This would send HTTP requests to my PHP on the backend. The PHP would then have an open socket with my java server that would store data in mysql or mongodb.
javascript client, PHP backend, Java server, mysql/mongo database.
Is this the appropriate way to set up a restful api in a general sense? If not, how should I do it?
You have it right. Javascript on the front end and PHP on the backend is an incredibly popular and powerful combination. The Apache server seems to be more popular among PHP users, but a java server works just fine.
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have an application done fully in JavaScript using Ember.js. What I want help with is the following:
I have two account types: basic and premium.
Depending on what account type the user have I wish to display ads him.
The user can use parts of my application only if he has a premium account.
What I must have in mind in order to protect my application so it's secure against people trying to use premium features without having that privilege? Because all Javascript will be sent as a single file, people can just look at all my app code and maybe reverse it or even copy it and use locally without even entering my site, which would put all my effort to waste.
Your client side code shouldn't be considered more than sugar for the user's experience, not a layer that is trusted.
That means your backend should be pessimistic in nature, not trusting requests from the client, but making sure they can make said request, and sanitizing any data sent to them assuming the user is trying to do harm.