Solved

post without reply

Posted on 2000-05-01
15
171 Views
Last Modified: 2010-04-09
Hi,

Is there a way to send data to the server without getting a new page? I would like to send if the checkbox was set or not and store in my java servlet. But I haven't found the way how to post without getting a reply or at least waiting a reply from the server.
Thanx
0
Comment
Question by:kapitany
  • 5
  • 5
  • 3
  • +1
15 Comments
 
LVL 1

Expert Comment

by:hkmdj
Comment Utility
You can post to the same page you have loaded. It still posts through, but may be faster because the page items are cached.  just change action to be the name of your current page and include any code you need on that page.

dj
0
 

Author Comment

by:kapitany
Comment Utility
Yes it might work but I don't want to reload the page even if it's cached.  I just want to post the state of a checkbox if it was changed and storing the checkbox state immediately. The state might be used in other windows as well. So how can I do a data sending to the server without any reply?? or frame reload...
kapitany
0
 
LVL 1

Expert Comment

by:hkmdj
Comment Utility
well, you kind of condemned yourself in wanting to 'post the state of a checkbox'.  Somethings got to give if you want to post.  Standard HTML is probably not going to do it for you.  If you are running Java Servlets or ASP or something, then you may be able to add a component or a control to perform this action.  the component would have to download with the first retrieval of the page and be running on the users machine while browsing that page, then it could communicate if the box was changed, but this is huge.  

The bigger question is why don't you want the page to reload? Is there something that is occuring that you need to stop?  maybe there is another way to attack this.
0
 
LVL 22

Expert Comment

by:CJ_S
Comment Utility
you could use a hidden frame which doesn't get any data or just a few bytes so you know that it reahced the server or sumthing....
0
 

Author Comment

by:kapitany
Comment Utility
hidden frame is a good Idea I will make a try :-)
0
 
LVL 22

Expert Comment

by:CJ_S
Comment Utility
Good luck, just remember to set the target for when you click on a link, or whatever.

CJ
0
 

Author Comment

by:kapitany
Comment Utility
Sorry but seems to be not the right solution. The problem is that it again stops the user to do anythinkk in the browser because it makes to wait util the reply arrives... So the user is stocked.. :-(  Isn't there a simple way just to send data without expecting any answer??
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 22

Expert Comment

by:CJ_S
Comment Utility
Nope, you will always receive a reply. How about opening a new window, and closing it right away? Makes the current browser still viewable, and the new window will hafta wait.

CJ
0
 
LVL 33

Expert Comment

by:knightEknight
Comment Utility
CJ_S, I think you were right to suggest a hidden frame -- the trick is to return something to that frame.  If no reply is sent, then the frame will wait forever.  kap, why don't you just return a small dummy page to the hidden frame each time?  Like this:

<HTML></html>
0
 
LVL 33

Accepted Solution

by:
knightEknight earned 10 total points
Comment Utility
Or, if you don't want to return anything to the hidden frame, then open the hidden frame with this file:

<HTML>
<HEAD>
<SCRIPT language='javascript'>
function stopme()
{
   self.stop();
   setTimeout("stopme()",500);
}
</script>
</head>
<BODY onLoad="stopme();">
</body>
</html>

I don't know for sure, but the theory is that the hidden frame will continuously "stop" checking for returning data.  Just a thought.
0
 

Author Comment

by:kapitany
Comment Utility
There is a little problem. The whole stuff seems to be working fine with the hidden frame. The only problem is that the target="hiddenframe" don't works when I'm using the onclick="this.form.submit()" method. It loads in the same frame from where the submit was done. I tried with a submit button it worked fine, but when I try with this onclick submit it don't works.
THIS DON'T WORKS:
<form name="noname" method="post" action="../servlets/AddBag" target="hiddenFrame">
<input type="hidden" name="name" value="Monopoly">
<input type="checkbox" name="checkbox" onClick="this.form.submit()">
</form>

THIS WORKS:
<form name="noname" method="post" action="../servlets/AddBag" target="hiddenFrame">
<input type="hidden" name="name" value="Monopoly">
<input type="checkbox" name="checkbox" onClick="this.form.submit()">
<input type="submit" name="Submit" value="Submit">
</form>

WOWW!
I just replaced the input type with "hidden" and it works fine!!!
So an other input stuff was needed.. But why ...
But the point that it works now!:-)

THANKS :-)))
0
 
LVL 22

Expert Comment

by:CJ_S
Comment Utility
KnightEKnight, that is what I suggested to send some data back, DOH.....
0
 
LVL 33

Expert Comment

by:knightEknight
Comment Utility
DOH!  I didn't see that either.  However, it was the other suggestion that finally worked for him.
0
 
LVL 22

Expert Comment

by:CJ_S
Comment Utility
KnightEKnight....well, that's cool =)....
0
 

Author Comment

by:kapitany
Comment Utility
Hi,

YEPP really cool :-)
Just one thing. I figured out that if I change  in the NON WORKING example the input order which means
<input type="checkbox" name="checkbox" onClick="this.form.submit()">
<input type="hidden" name="name" value="Monopoly">

then it works fine. Maybe this.form.submit() just sends what is coming after and don't cares what was before :-)))

0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how add a full-size background image to a webpage using CSS3. Create a new HTML document with an internal stylesheet.: In CSS, define the html element to have a background image. Use a high resolution image.: In t…
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…

771 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now