Go Back   CodingForums.com > :: Client side development > JavaScript programming > Ajax and Design

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-20-2010, 06:14 PM   PM User | #1
badHabitZ
New Coder

 
Join Date: Jun 2010
Posts: 68
Thanks: 9
Thanked 0 Times in 0 Posts
badHabitZ is an unknown quantity at this point
Editing using AJAX ??

Hello people,

I am wondering, I have got a very simple question. I have a page, for example where news is being displayed like below:

Code:
Posted by: Administrator

News Message: Lorem ipsum bla bla
Now I want to do the following. When I click on a button, I want to show a text input field where "Administrator" is being displayed, and a text message input field where the news is being displayed, without reloading the page.

Here the example with images:

Step 1
This is what I am seeing on my webpage:



Step 2
Now I click on some button (edit button), and the following is being displayed WITHOUT reloading the page:

Step 3


So what I am getting basically, is an edit form so I can directly edit the news and then hit the "edit" button again to post the edited news.

Can someone tell me if this is indeed done with AJAX and if so (or not) can someone point me in the right direction by showing me a tutorial of how to accomplish this, so I can get started with it? The only thing I need is the "function" to show the edit form without reloading the page.

Thanks in advance.
badHabitZ is offline   Reply With Quote
Old 07-20-2010, 08:43 PM   PM User | #2
Rowsdower!
Senior Coder

 
Rowsdower!'s Avatar
 
Join Date: Oct 2008
Location: Some say it's everything.
Posts: 2,007
Thanks: 5
Thanked 395 Times in 388 Posts
Rowsdower! has a spectacular aura aboutRowsdower! has a spectacular aura aboutRowsdower! has a spectacular aura about
Yes. The initial switch-over to editing mode is javascript all by itself - no biggie. Actually sending the new data to the server to be saved is done with what we call "AJAX."

You set up the "save" button or whatever to send an http_request using either "post" or "get" (I'd stick with post for this). Then on the server you have a page set up to have the javascript send to that takes the data, validates the input to make sure it's legit, and then updates your database with the new post information.

This is definitely AJAX though, so yeah. You're on the right track.
__________________
The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
See Mediocrity in its Infancy
It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
Seek and you shall find... basically:
validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting
Rowsdower! is offline   Reply With Quote
Old 07-20-2010, 09:07 PM   PM User | #3
badHabitZ
New Coder

 
Join Date: Jun 2010
Posts: 68
Thanks: 9
Thanked 0 Times in 0 Posts
badHabitZ is an unknown quantity at this point
Quote:
Originally Posted by Rowsdower! View Post
Yes. The initial switch-over to editing mode is javascript all by itself - no biggie. Actually sending the new data to the server to be saved is done with what we call "AJAX."

You set up the "save" button or whatever to send an http_request using either "post" or "get" (I'd stick with post for this). Then on the server you have a page set up to have the javascript send to that takes the data, validates the input to make sure it's legit, and then updates your database with the new post information.

This is definitely AJAX though, so yeah. You're on the right track.
Okay, sounds cool, I'll look into that tomorrow then and if I need some help finding some tutorials, I'll post in here again
badHabitZ is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 06:29 AM.


Advertisement
Log in to turn off these ads.