Version 1
[yaffs-website] / vendor / jcalderonzumba / gastonjs / docs / api / commands / javascript / execute.md
diff --git a/vendor/jcalderonzumba/gastonjs/docs/api/commands/javascript/execute.md b/vendor/jcalderonzumba/gastonjs/docs/api/commands/javascript/execute.md
new file mode 100644 (file)
index 0000000..63d8975
--- /dev/null
@@ -0,0 +1,28 @@
+execute
+=========
+Command to execute javascript code within the current page you are browsing.
+
+##Example of use
+####Request
+```json
+{
+    "name": "execute",
+    "args": [
+        "(function () {\n  document.getElementById(\"element_1\").value = \"THIS_IS_SPARTA\";\n  document.getElementById(\"element_3\").selectedIndex = 1;\n})();\n"
+    ]
+}
+```
+####Response
+If there are no javascript errors then the response should be:
+```json
+{
+    "response": true
+}
+```
+##Rule of thumb for javascript code
+As a recommendation try always to make your code like this:
+```javascript
+(function () {
+  //Here should go all the code you want to execute
+})();
+```