0
Good, I have the following javascript code and when I try to add the strMessage
it does not add up, but adds side by side to the value and so on each time it runs, which I am doing wrong?
function main() {
var s = 0;
//Espera um segundo
setInterval(function() {
$.ajax({
url: 'teste3.php',
success: function(strMessage) {
s += strMessage;
},
});
document.write(s);
}, 1000);
}
window.onload = main;
maybe you would have to make strMessage a number in javascript
– user60252
Convert string to integer.
– Renato Junior
perfect, resulted gave a parseint() and resulted
– Music Lyrics HQ
s += parseint(strMessage); ??
– user60252
yes, that’s right
– Music Lyrics HQ
there are no decimal numbers?
– user60252
no ,because????
– Music Lyrics HQ
if there were
parseFloat
– user60252
in which way we won’t leave a question unanswered
– user60252
Hmm ok, actually that might make me miss further ahead
– Music Lyrics HQ