0

I have a local IP as URL http://192.168.1.100 After pressing a button on the page, it sends a http request and the new URL looks like http://192.168.1.100/?P=22. I have used the HTML tag to auto refresh the page because I need it. And this caused the same request to be sent each time it refreshes and it is obvious. My question is: How to remove the part ?P=22 after the request is sent and on auto refresh the URL is 192.168.1.100 again.

  • did you try $windows.reload – Kevonia Tomlinson May 26 '16 at 15:11
  • If you don't want it as part of the URL why aren't you posting the data? – zzzzBov May 26 '16 at 15:11
  • Possible duplicate of [How do we update URL or query strings using javascript/jQuery without reloading the page?](http://stackoverflow.com/questions/12508225/how-do-we-update-url-or-query-strings-using-javascript-jquery-without-reloading) – mhodges May 26 '16 at 15:18
  • @zzzzBov. I have several buttons on the webpage. When I press a button, it sends P=22 to the server and the result is http://192.168.1.100/?P=22. And, as I have already mentioned, I have the autorefresh HTML tag because I need to refresh the page automatically on the client side. – Siddharth May 29 '16 at 12:50
  • @Siddharth, that doesn't clarify my question. *why* do you need to refresh the page client side? *why* does the data need to be transmitted in the query string instead of the message body? What you're asking appears to be an [XY Problem](http://meta.stackexchange.com/questions/66377/what-is-the-xy-problem). Rather giving you bad advice by giving you what *you think* you need, I'd rather know more about the overall problem to point you in the right direction. – zzzzBov May 29 '16 at 15:28
  • @zzzzBov.I need to refresh the page on the client side because the overall project name is "Data Acquisition System".I have many sensors on the server side(and my server is Arduino) and the sensor values must get updated within very short time on the client side.That is why I am using autorefresh in timely manner. And the query string is all about http request. When I press a button,it sends a http request using get method. Moreover, the server is programmed to identify a charecter sent in from of the query string (eg.?P=22) and do the job(like lighting the bulb, turning motor ON or OFF etc). – Siddharth Jun 02 '16 at 14:32
  • @zzzzBov. But, the server side is completely based on Arduino microcontroller and it is not an issue too. Hope you understand why I am automatically refreshing the client page and why I am transmitting data using a query string. – Siddharth Jun 02 '16 at 14:32
  • @Siddharth, [it sounds like you should use websockets](https://developer.mozilla.org/en-US/docs/Web/API/WebSockets_API), or if they're not an option, you should probably use AJAX to make the web requests, to remove the need for any sort of page refreshing. – zzzzBov Jun 02 '16 at 14:37
  • @zzzzBov. Yes, AJAX may be the better solution. Thanks for the suggestion. I will try it. – Siddharth Jun 05 '16 at 08:38

0 Answers0