-->

Tuesday, 20 October 2015

Get OTP Using JavaScript

 <script>
            var otp_sent = 0;
            function get_otp() {
                return;
                if (otp_sent == 1) {
                    alert("OTP already sent........");
                    return;
                }
                var mobile_number_val = document.getElementById("mobile_number").value;
                var fid = "21";
                var did = "";
                var bid = "";
                otp_sent = 1;
                $.post("ajax_fucntion.aspx",
                {
                    function_id: fid,
                    contact_number: mobile_number_val
                },
                function(data, status) {
                    alert(data);
                }).fail(function(jqXHR, textStatus, errorThrown) {
                    alert("some error in submiting form plesase re-submit..");
                    _save.disabled = false;
                }); 

                //alert(mobile_number_val);
            }
        </script>                             

Saturday, 1 November 2014

How to print message using javascript

To print a statement, you can use alert or console.log.
alert("prosourcecode");
console.log("prosourcecode");
Semicolon can be omitted most of the time, but you should always add a semicolon, because if you don't, the compiler sometimes will get it wrong, resulting hard-to-find bugs.

Getting started javascript tutorials by example

This page will quickly get you started on JavaScript the language. You need to have basic understanding of the language before you can script the DOM/web.

Running JavaScript

To evaluate a piece of JavaScript code, you need to call it in a HTML file and view the file in browser.

Here's how to embed JavaScript into HTML. If you just have few lines of code, do:
If you have more than a few lines of code, put them in a file, and call it like this:

Use Browser's Web Developer Console:

In Google Chrome: 〖Tools ▸ JavaScript Console〗 .
In Firefox: 〖Tools ▸ Web Developer ▸ Web Console〗.
In Safari: 〖Develop ▸ Show Error Console〗.
In Internet Explorer 9: 〖Tools ▸ F12 Developer Tools〗.

Using node.js

Another good way to run JavaScript code is node.js. With node.js, you can run JavaScript like shell scripts in terminal.
On Linux, install by sudo apt-get install nodejs. Or get it at http://nodejs.org/.
You can run it interactively. Type node to start the interactive prompt. Type Ctrl+d to exit.
You can also run it as shell script. Save a JavaScript code in a file  “myscript.js”. Then, you can run the script in shell like this: node myscript.js.
© Copyright 2019 Project Source Code | All Right Reserved