How to write the result document.write('34'); into a variable?


Warning: count(): Parameter must be an array or an object that implements Countable in /home/styllloz/public_html/qa-theme/donut-theme/qa-donut-layer.php on line 274
0 like 0 dislike
29 views
The issue is that I need to record the execution result document.write('34'); into a variable, and googling I have not found how to do it.

document.write('34'); comes from the server, so to change it I can.

UPD:
I understand that this is fundamentally wrong, but

var a = open("POST", "http://meteo.swamp.ru/js.php", false);
alert(a);


Outputs: object DOMwindow

That is, it still works?
by | 29 views

4 Answers

0 like 0 dislike
\rdocument.write = function(text) {\ralert(text);\r}\rdocument.write('34');\r\r
by
0 like 0 dislike
You can get the result as a simple string and to extract the desired part as a substring.
by
0 like 0 dislike
I was slightly familiar with js, but as an option to override
document.write = function(x) {return x;}
to get rid of response using eval:
var x = eval (response)
and return old write on place.
It seems so possible to do.
by
0 like 0 dislike
If you come, it makes sense to use parseInt or parseFloat.
by

Related questions

0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
0 like 0 dislike
2 answers
0 like 0 dislike
1 answer
asked Jun 13, 2019 by alex4answ
110,608 questions
257,186 answers
0 comments
27,835 users