Click here to Skip to main content
15,891,749 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
I am trying to do a project of one page user interfase that displays an empty to-do list and containts a form that allows user to enter a task to add to thier to-do list. the list list should be displayed immmediately after a user adds them,without a page reload.

I have written the html code for it but with javascript how to display the list in the same page without reload. can anybody help me.

The html code is below

HTML
<html>
<Head></head>
<Body>
<form name ="to-doform">
Task to be completed<input type = "text" Name="task" size = "30">
<select>
Priorty  
<option value=""></option>
<option value="High">High</option>
  
<option value="saab">Medium</option>
  
 
 <option value="audi">Low</option>
</select>


<input type = "button" name = "but1" value = "add task">

Basically I want to create a todo list with javascript using priority

</form>
Posted
Updated 11-Jun-12 16:27pm
v3
Comments
Sergey Alexandrovich Kryukov 11-Jun-12 21:19pm    
Not clear. You cannot just write JavaScript to act on its own. Where is the source of information to be presented on list.
Are you seriously going to work only on client side? Without reload -- reload what?
--SA
Ganesan Senthilvel 11-Jun-12 22:18pm    
code format
Sandeep Mewara 12-Jun-12 2:30am    
I told you yesterday too, there is a textbox just below question body in edit mode where you can add your comments about editing. Please use it.
Mary Abraham 12-Jun-12 2:36am    
I think now it is formated
Mary Abraham 12-Jun-12 2:35am    
can I get an answer sorry for the inconvenience

1 solution

with javascript how to display the list in the same page without reload.
Using XMLHttpRequest or jQuery AJAX, you can update server side and then create needed controls on client side. Once you have the controls created, add them to the placeholder of 'to-do' list.

Refer:
Have a look at these for XMLHttpRequest or jQuery AJAX:
XMLHttpRequest Object[^]
Invoke Server Methods From Client Side Using jQuery AJAX in ASP.NET[^]

For creating controls on client side:
Use jQuery:
http://api.jquery.com/append/[^]
http://api.jquery.com/html/[^]
Or raw JavaScript, like:
JavaScript
var inp = document.createElement('input');
    inp.name = "control1";
    inp.type = "text";
    inp.id = "control1";
    document.getElementById("yourcontainer").appendChild(inp);
 
Share this answer
 
Comments
Espen Harlinn 12-Jun-12 8:18am    
5'ed!
Sandeep Mewara 12-Jun-12 12:55pm    
Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900