refresh only if changed php-ajax [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
well, I have a comment system that is updated every second with jQuery, but I want to update only if there are changes, that is, only if there are new records in the database. is there a way to do this?
Excuse my English, but I'm using google translator

You may create two function in JS. First function ask php script, which check changes, and, if data changed, run second JS function, which get data and update DOM.
Php is not may send info on loaded http page independently, without request from client side.

Related

Do I need submit buttons with ajax applications [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Closed 8 years ago.
Improve this question
Posting data to the server needs a form-tag.
But do I also need a button of type 'submit' when I use ajax/jquery?
Can I not just interrupt the button click and do my own ajax request?
No, and technically you don't even need a form tag if you want to serialize the POST data yourself.
If you are using Ajax then you don't technically, need a form tag or a submit button.
Having them gives you convenient, semantic elements with logical events to bind the JavaScript to.
Having them is needed for the JS to be unobtrusive (which is a best practise).

how to use php or js to record the stay time of user in my web site page? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
how to use php or js to record the stay time of user in my web site page?
someone click a link and jump to my website page, he stay in the page for 5 seconds then close the page.
I want to record the 5 seconds to my database , how can I do the job using js or php?
it seems as the same as ga, but I don't know how ga do this.
You can use javascript's setInterval method to periodically send something to your server
For example:
setInterval(function(){
sendToServer()
},1000);

how can I disable copying images from browsing my website [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
There is an option for disabling right click on the website on the computer but on the mobile I don't know which javascript code I would need.
Images have to be copied from the web server to the client system in order for the client system to display them.
There is no way to stop people from saving them.
There is an option for disabling right click on the website
Not one that can't be trivially bypassed.
There's no way to actually block an image from being copied. If it's being shown to the user, they can obtain it. The resource is already sent to them for render anyways.

Showing a local RSS Feed on my app? [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Improve this question
So i'm using phonegap build with, html5 jqm and javascript and css obviously.
i have a local rss feed in xml format that has been made and will be updated with new events etc.
i want the RSS feed to show like a list basically at the moment i'm no bothered with anything fancy look as i've not even managed to get it to show up, all my efforts have been futile.
Any answers accepted. For practicality lets call the feed rss.xml.
Thanks!
You may use jfeed, for example
jQuery.getFeed({
url: 'rss.xml',
success: function(feed) {
console,log(feed.title);
}
});
Also, you can use $.get, here is an example for PhoneGap and an article worth reading.

Synchronous changes to webpages useing javascript [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
This is most likely a very simple question but i am new to server-client programming i am used to only a client. I want an action that is taken on one person's browser to effect the state of the screen to all people that are looking at it.
I doubt it is that hard but i have no idea. And after some googling i can't find anything.
Take a look at websockets, which allow you to open up a constant connection between the client and the server.
Basically you will need the "host" to send its screen data to the server via websocket (or possibly AJAX), which can then transfer the data to the "viewers" (which is where the websockets will be superior to AJAX).

Categories

Resources