Form Data Posting

20 views
Skip to first unread message

pankaj

unread,
Jul 22, 2011, 2:00:13 AM7/22/11
to Raplet developer discussion list
Hi,

I am a newbie as raplet development is concerned. I have followed all
the tutorials and tested the code regarding the implementation of
raplets. What i am curious to know is how can i post data to the
server?

For e.g. I have one text box and submit button. User fills some data
in the text box and clicks on submit button. This data should be
posted to the server.
I have created text box and submit button inside the form tag under
html parameter. The raplet is properly loaded with text box and submit
button. When i click on the submit button whole page is refreshed i.e.
gmail url.
What i want is that only raplet container should reload?

I am confused how to make it happen. Should i use ajax?

Please help me on this. If there is any reference related to this
please suggest.


Thanks,
Pankaj

Martin Kleppmann

unread,
Jul 22, 2011, 7:41:40 PM7/22/11
to raple...@googlegroups.com
Hi Pankaj,

The easiest way of achieving this is with an iframe. Rather than
including your form HTML in the Raplet response, just make the Raplet
HTML something like <iframe src="http://yoursite.com/form" width="200"
height="200"> and load the form HTML from http://yoursite.com/form.
When you post that form, only the iframe will be refreshed. This has
the downside that you have to set a fixed size for the iframe, but if
that's not a problem for you, this is the simplest solution.

Alternatives would be to use JSONP with an OAuth2 token, or Ajax with
cross-origin resource sharing (CORS), but they are a bit more
complicated to set up.

Best,
Martin

--
Martin Kleppmann
Co-founder, Rapportive
http://rapportive.com

> --
> You received this message because you are subscribed to the Google
> Groups "Raplet developer discussion list" group.
> To post to this group, send email to raple...@googlegroups.com
> To unsubscribe from this group, send email to
> raplet-dev+...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/raplet-dev?hl=en
>

Martin Kleppmann

unread,
Jul 22, 2011, 7:44:52 PM7/22/11
to raple...@googlegroups.com
Oh, and to correct myself: it would of course be best to use a
https:// page for your form and your raplet, not http:// since Chrome
is moving towards blocking non-encrypted content inside secure pages.

Best,
Martin

--
Martin Kleppmann
Co-founder, Rapportive
http://rapportive.com

Reply all
Reply to author
Forward
0 new messages