Jump to content

ravi_k

Members
  • Content Count

    18
  • Joined

  • Last visited

Community Reputation

0 Neutral

About ravi_k

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Hi I am using ajax to get the data received at server side . In the below mentioned link,It is mentioned that: The onreadystatechange event is triggered four times (1-4), one time for each change in the readyState. https://www.w3schools.com/js/js_ajax_http_response.asp In my case, some times the data is received 2 or 3 times when am sending it only once. How to receive data only once.Please suggest Thanks and Regards Ravi K
  2. Hi Guys, How to get NTP server time using HTML? Can anyone share a example for getting NTP Server time using HTML? Thanks with Regards Ravi K
  3. Hi How can i access sd card files present in MCU from web server? I tried the below method but the browse button takes to PC browse instead of SD card in MCU. <form action="/upload" id="upload" method="post"> <input type="file" id="fileupload" name="myfile"> <input type="submit" value="submit" id="submit" > </form> Please help Thanks with Regards Ravi K
  4. Hi I am using prevent default to restrict the submitted data posting on other page. It works fine but i try to call other function also with onsubmit to get a alert from server after submitting it. In below onsubmit am calling 2 functions, only one works. <form name="myForm0" action="/volumeflow" method="post" autocomplete="off" id="vlmn" target="formDestination" onsubmit="return volflow12(event); volflow_check()"> But it does not work. I tried with onsubmit and onclick. What is the issue <script > function volflow_check() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { alert("volume flow submitted successfully"); } }; xhttp.open("GET", "volumeflow_check", true); xhttp.send(); } function volflow12(event) { var w = document.forms["myForm0"]["damping0"].value; var x = document.forms["myForm0"]["flowcutoff0"].value; var z = document.forms["myForm0"]["decimal0"].value; if (w == "") { alert("Field 1 must be filled out"); return false; } else if (x == "") { alert("Field 2 must be filled out"); return false; } else if (z == "") { alert("Field 3 must be filled out"); return false; } else { myFunctionabcd33(event); } } function showForm2() { var selopt =document.getElementById("optsv").value; if (selopt == 1) { document.getElementById("f3").style.display = "inline"; document.getElementById("f4").style.display = "none"; } else if (selopt == 2) { document.getElementById("f4").style.display = "inline"; document.getElementById("f3").style.display = "none"; } else { document.getElementById("f4").style.display = "none"; document.getElementById("f3").style.display = "none"; } } function myFunctionabcd33(event) { var myForm = document.getElementById('vlmn'); event.preventDefault(); formData = new FormData(myForm); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("vlmn").innerHTML = this.responseText; } }; xhttp.open("POST", "volumeflow",true); xhttp.send(formData); return true; } </script> <form name="myForm0" action="/volumeflow" method="post" autocomplete="off" id="vlmn" target="formDestination" onsubmit="return volflow12(event); volflow_check()"> <label>Volume Flow Unit Selection:</label> <select id='optsv' name='Selectunit' onchange="showForm2()"> <option value="0">Select Option</option> <option value="1">SI units</option> <option value="2">US units</option> </select> <div id="f3" style="display:none"> <select id='opt3' name='SIunits' onchange="showForm2()"> <option >Select</option> <option value="0">Lit/Sec</option> <option value="1">Lit/min</option> <option value="2">Lit/hr</option> <option value="3">Lit/day</option> </select> </div> <div id="f4" style="display:none"> <select id='opt4' name='USUnits' onchange="showForm2()"> <option >Select</option> <option value="0">Gal/min</option> <option value="1">Gal/hr</option> <option value="2">Gal/Sec</option> <option value="3">Gal/day</option> </select> </div> <br> <br> <label> Volume Flow Damping:</label> <input type="text" name="damping0" size="10"> <br><br> <label> Volume Flow Cutoff:</label> <input type="text" name="flowcutoff0" size="10"> <br><br> <label> Volume Decimal Places:</label> <input type="text" name="decimal0" size="10"> <br><br> <span style="margin-right:24.5%;"></span> <input type="submit" value="Submit"> </form> Please suggest , why two functions are not able to call Thanks with Regards Ravi
  5. Hi I am not receiving any value. To check if am getting any value , i am just getting a value and try to print it in a text box But nothing prints. I think some issue is there <p id ="sensor_progress"></p> <div> <button onclick="Sensor()">Sensor</button> &emsp;&emsp;&nbsp;&nbsp; <progress id="myProgress" value="22" max="100"> </progress> <input type="text" id="sensor_progress" size ="7"style="border: 2px solid black;font-size:20pt;" disabled> <script> function Sensor() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("myProgress").value =this.responseText; document.getElementById("sensor_progress").value = this.responseText; } }; xhttp.open("GET", "sensor.txt", true); xhttp.send(); } </script> Thanks with Regards Ravi
  6. Hi Whether the calling of document.getElementById("myProgress").value =this.responseText; is proper or not? May be its not receiving the value properly. Thanks with Regards Ravi
  7. Hi I have a below code, which shows a progress bar. default it shows as 22. but when i receive the data from server , the progress bar data should be changed. <div> <button onclick="Sensor()">Sensor</button> <progress id="myProgress" value="22" min="0"max="100"> </progress> </div> <script> function Sensor() { var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("myProgress").value = this.responseText; } }; xhttp.open("GET", "sensor", true); xhttp.send(); } </script> Thanks with Regards Ravi
  8. Hi If i don't send anything form server for the post request( using the earlier method of onclick), then the form is submitted and no data is received on client side except that client request is received 3 to 6 times continuously for 1 post request send.(here if i can avoid multiple requests , issue is solved) Above method suggested by Dsonesuk, i will try this once Thanks With Regards Ravi
  9. Hi With onsubmit, no value is received on server .nothing is sent by client. Thanks With Regards Ravi
  10. Hi Am using a post request. As suggested above am already using preventDefault() in my code using form data . <form action="/val" method="post" id="val" name="val" > Value:&emsp;<select name='val' > <option value="0">Zero</option> <option value="1">One</option> </select> <input type="submit" value="Submit" onclick="myFunction_value(event)"> </form> <script> function myFunction_value(event) { var myForm = document.getElementById('val'); event.preventDefault(); formData = new FormData(myForm); var xhttp = new XMLHttpRequest(); xhttp.onreadystatechange = function() { if (this.readyState == 4 && this.status == 200) { document.getElementById("val").innerHTML = this.responseText; } }; xhttp.open("POST", "val",true); xhttp.send(formData); return true; } </script> Thanks With Regards Ravi
  11. Hi guys How to submit a form using ajax without redirection to other page and stays on same page. Now redirection is not happening but i get the below message on client web page. Value selected : -----------------------------117571124310148 Content-Disposition: form-data; value="zero" 0 -----------------------------117571124310148-- Thanks With Regards Ravi
  12. ravi_k

    submit and hide

    Hi I have changed my code as below. <form action="/action_page.php" method="post"> Testing: &emsp;&nbsp;&nbsp;<input name="ip" id="ip" type="text" min="0" max="255"> <input type="submit" value="Start"> <input type="submit" value="Stop"> </form> How can i differentiate which button is pressed on server side whether its start or stop. Please suggest Thanks with Regards Ravi K
  13. Hi I am trying to submit the form and also when start is pressed, it should be disabled and only stop to be avialable. I tried below code but submit form is not happening <form action="/action_page.php" method="post"> Testing:   <input name="ip" id="ip" type="text" min="0" max="255"> <input type="submit" id="start" value="start" onclick="myFunction1()"> <input type="submit" id="stop" value="stop" onclick="myFunction2()"> </form> <script> function myFunction1() { document.getElementById("start").disabled = true; document.getElementById("stop").disabled = false; } function myFunction2() { document.getElementById("start").disabled = false; document.getElementById("stop").disabled = true; } </script> Thanks with Regards Ravi K
  14. Hi Thanks for the reply. Actually form action i have changed and method to post. here my problem is , when it sends to server as "List1=Apparel&List2=Men&List3=Shirts&List4=Tux " i am parsing the string using c code for alphabets..i remove all the alpahbets and =&.. so that only values are available and i can use it. for this multiple dropdown also, i need values so that i can parse alphabets. How to do it.Please help Thanks with Regards Ravi K
  15. Hi Now am able to submit it. But while submitting it shows output as List1=Apparel&List2=Men&List3=Shirts&List4=Tux instead how to link above code with values. I mean as List1=0&List2=1&List3=2&List4=3 Is there a way to link....but in array same names can be used as apparel men etc but while submit i need it as values..How to link it Please suggest Thanks with Regards Ravi K
×
×
  • Create New...