ajax is not that different from dajax.. actually almost same logic.. but 
look, i try to explain how it should work.. 

your index.html

<a href="#" onclick="ajaxfunction()" ><input name="wanted_value" 
type="hidden"/>click me</a>

and your ajaxfunction in the head of this index.html is this. 

function ajaxfunction(){
wanted_value = $("input[name='wanted_value']").val();
 $.ajax({
url: "/ajax/",
type: "POST",
data: {value_key: wanted_value}
 }).complete(function(){
alert('ajax worked yihuu!');
});
}

and what it does is: it sends the data to /ajax/ url, and you catch it in 
your urls and forward it to your views.. then process the data and you are 
lucky.. 


 

Am Montag, 14. Mai 2012 15:19:06 UTC+2 schrieb voss:
>
> Hi Am, this sounds like a good idea, and I think it may work in my case 
> (with dajax). Thank you!
>
> I have a question, though. I know that with dajax, the data is passed to 
> the ajax views in ajax.py, and the result is then sent back to the same 
> html page. But how exactly does your method work? (I have no experience in 
> ajax.)
> For example, how do you call an ajax function and how do you link it to 
> views.py? 
>
>
> On Saturday, May 12, 2012 12:16:45 AM UTC-5, doniyor wrote:
>>
>> just after your for loop, you can call ajax function which takes the 
>> values of your newly created lists and submits this further to your view. 
>> you dont need to load the whole page and the data will silently go to your 
>> view. 
>>
>>
>>
>> Am Freitag, 11. Mai 2012 23:37:08 UTC+2 schrieb voss:
>>>
>>> Hello,
>>>
>>> I have a list that is created dynamically, and the code looks like:
>>>
>>> <script type="text/javascript">
>>>     ...
>>>     ...
>>>     for (i=0; i<array.length; i++)
>>>          {
>>>               dojo.create("li", {innerHTML: array[i]}, 
>>> dojo.byId("test"));
>>>          {
>>> </script>
>>>
>>> <body>
>>>     <ul id="test"></ul>
>>> </body>
>>>
>>> How to pass the list values (i.e.,array[]) to views for further work?
>>>
>>> Thanks!  
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/django-users/-/sUM1WT6axzAJ.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to 
django-users+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en.

Reply via email to