www.webdeveloper.com
Results 1 to 7 of 7

Thread: Question regarding HTTP Requests

  1. #1
    Join Date
    May 2013
    Posts
    5

    Question Question regarding HTTP Requests

    Hello people,

    I'd like to know if there's a way to change a value of a textfield via the Requests sent by a sub-domain?

    For example:
    A textfield has the value of 0 on page "bla.com/bla1"

    And the value only changes to 1 if I visit the site "bla.com/bla2"

    I want to do this via Request handling, what should I do?
    It is possible over Ajax, but what's the best way to do this?

    Greetings,
    Dave

  2. #2
    Join Date
    Oct 2010
    Location
    UK
    Posts
    17
    Straight up JavaScript method - there'll no doubt be better ways. Using jQuery would make this much cleaner also.

    Code:
    <textarea id="mytextarea">0</textarea>
    
    <a href="javascript:void" onclick="javascript:updateTextarea()">Visit other site</a>
    
    <script>
    function updateTextarea(){
    	mytextarea = document.getElementById('mytextarea');
    	mytextarea.value = '1';
    	
    	window.open('http://www.google.co.uk/');
    }
    </script>
    Saying that, the user could just close the new window/tab so it's far from bulletproof.

  3. #3
    Join Date
    May 2013
    Posts
    5
    Well yeah, but that's not what I asked for.
    I wanted to do this via Requests. So the "bla.com/bla1" site sends out requests until it gets the request back from "bla.com/bla2" with "successful".
    It's just about make sure that he visited the other webpage.
    Shall I explain it better or did you understand it?

  4. #4
    Join Date
    Oct 2010
    Location
    UK
    Posts
    17
    Sorry, misread.

    You may be able to set a cookie when the user visits "bla.com/bla2" and then run a ajax timeout at "bla.com/bla1" to check if that cookie exists. If it exists, set textarea value to 1.

    Just at work at the moment, but someone else may be able to provide a snippet of code

  5. #5
    Join Date
    May 2013
    Posts
    5
    Quote Originally Posted by Aralus View Post
    Sorry, misread.

    You may be able to set a cookie when the user visits "bla.com/bla2" and then run a ajax timeout at "bla.com/bla1" to check if that cookie exists. If it exists, set textarea value to 1.

    Just at work at the moment, but someone else may be able to provide a snippet of code
    If you could do that later or tomorrow, it would be cool.
    I can wait .. =)

    But, if anyone else got an idea about this, just help!

  6. #6
    Join Date
    May 2013
    Posts
    5
    Is pushing a thread allowed?
    If yes, #push

  7. #7
    Join Date
    May 2013
    Posts
    5
    Comon people. I need help here.
    If someone can handle this or is atleast a bit skilled in Js, please message me.
    I need to do something which must be finished today. I'll pay him if needed..

    But I first need a solution over this.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles