473,385 Members | 1,780 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

AJAX comments form

12
Hi all,

i am new to AJAX, so need some help

I want to create simple feedback (comment) form, base on AJAX.
So, I have my HTML form, and even have my SQL database, and PHP script.
All is working quite ok, but I need to make it AJAX - the main reason is, that I DONT NEED PAGE TO BE RELOADED.

What can You suggest?

If needed, I will post all the codes here.

Thx.
May 24 '07 #1
3 1745
acoder
16,027 Expert Mod 8TB
First of all, read up on AJAX - see links in Offsite Links sticky thread.

Presumably, you'll want to make a POST request. The tutorials (or some of them at least) explain this very well.

If you get stuck, post your javascript code.
May 24 '07 #2
praveen2gupta
201 100+
Hi all,

i am new to AJAX, so need some help

I want to create simple feedback (comment) form, base on AJAX.
So, I have my HTML form, and even have my SQL database, and PHP script.
All is working quite ok, but I need to make it AJAX - the main reason is, that I DONT NEED PAGE TO BE RELOADED.

What can You suggest?

If needed, I will post all the codes here.

Thx.


If you are new then read w3.org for the ajax details. Underatand the basic concepts and apply after that. I am using ajax in my projects. It also
creats some problems. For initial code wait for one ot two days. I will be posting it.
May 29 '07 #3
praveen2gupta
201 100+
If you are new then read w3.org for the ajax details. Underatand the basic concepts and apply after that. I am using ajax in my projects. It also
creats some problems. For initial code wait for one ot two days. I will be posting it.
-------------------------
write the following code and save as ajaxtest.html . create another file and write some text there and save as test1.html . now run ajaxtest.html from a server. a button will appear on browser. click it you will get the text written in the test1.html file at the div tag without refreshing the browser. Test it with some images you will feel the difference.

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3. <html>
  4. <head>
  5. <title>Ajax at work</title>
  6.  
  7. <script language = "javascript">
  8.  
  9.  
  10. var httpObj = false;
  11.  
  12.     if (window.XMLHttpRequest) 
  13.     {
  14.         httpObj = new XMLHttpRequest();
  15.     } 
  16.     else if (window.ActiveXObject) 
  17.     {
  18.         httpObj = new ActiveXObject("Microsoft.XMLHTTP");
  19.     }
  20.  
  21.  
  22.  
  23.  
  24.     function getData(dataSource, divID)
  25.     {
  26.         if(httpObj) 
  27.         {
  28.             var obj = document.getElementById(divID);
  29.             httpObj.open("GET", dataSource,true);
  30.             httpObj.onreadystatechange = function()
  31.             {
  32.                 if (httpObj.readyState == 4 && httpObj.status == 200) 
  33.                 {
  34.                     obj.innerHTML = httpObj.responseText;
  35.  
  36.                 }
  37.             }
  38.             httpObj.send(null);
  39.         }
  40.     }
  41. </script>
  42. </head>
  43. <body>
  44. <H1>Fetching data with Ajax</H1>
  45.  
  46. <form>
  47.  
  48. <input type="button" value="Display Message" onmouseover='getData("test1.html","targetDiv")'>
  49.  
  50. </form>
  51.  
  52. <div id="targetDiv">
  53. <p>The fetched data will go here.</p>
  54. </div>
  55. </body>
  56. </html>
  57.  
  58.  
May 30 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

10
by: Steve | last post by:
I need to build a very dynamic client and would be interested in knowing the pros and cons of using JSF and Ajax to accomplish this. Thanks. Steve
31
by: Tony | last post by:
I just noticed that prototype.js is one of the files in the Ajax.NET distribution - I'm pretty concerned about this. Does anyone know if this is the same "prototype.js" that is not well-liked...
1
by: gamernaveen | last post by:
Hey guys , am just getting into the AJAX scene and am a noob. I am really worried about Ajax upload , cant figure it out. I have a basic html form , like this <form action="upload.php"...
9
by: Tim Johnson | last post by:
I'm an experienced web/CGI programmer, but new to ajax. I'd like to review some examples of how to post data from a form to server using AJAX. I have already created some examples successfully...
1
by: Mark B | last post by:
This is my first try at using AJAX. I want the calendars to be enabled if the user checks CheckBox1. It works OK for a normal all page refresh but once I introduced the AJAX code it stopped...
7
by: RichB | last post by:
I am trying to get to grips with the asp.net ajaxcontrol toolkit, and am trying to add a tabbed control to the page. I have no problems within the aspx file, and can dynamically manipulate a...
4
by: Peter | last post by:
ASP.NET 2.0 I have an AutoCompleteExtender which works fine- I am using name, id pair in the WebService , but what I am trying to do is: once the user selects an item from the...
3
by: ToddFur | last post by:
I see several postings on this but I am still unable to figure out my problem. I can pass the values of my text field but not radio button (or even checkboxes). My PHP file <?php //declare...
7
by: mike57 | last post by:
The minimal AJAX script below works in Firefox, but not in IE, Opera, or Chrome. I could use some suggestions or referrals to resources that will help me get the script working in other browsers. ...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.