I am using Django 1.8 and Python 3.5
This is my urls.py file
from django.conf.urls import include, url
from django.conf.urls.static import static
from django.contrib import admin
from django.conf import settings
urlpatterns = [
# Examples:
url(r'^$', 'mainpage.views.home2', name='home2'),
url(r'^currency/(?P<currencywa>[\w]+)', 'currency.views.curr1', name='curr1'),
url(r'^userpage/', 'login.views.userpage', name='userpage'),
]
I am trying to make links using Jquery for Django
what I want to do is this
<a href="somelink">test</a> // this resides in a table
using jquery
I wish to use urlnames instead of url that is I wish to use name='curr1'
var typein="<a href=\"{% url 'curr1'%}\">test</a>";
$('#cryptotable > tbody:last-child').append('<tr id=\"5\"><td>data1</td> </tr>');
I want to do this equivalent in django
<a href="{% url 'home2'%}">test</a>
But when I click on this ,I get redirected to http://localhost:8000/{% url 'curr1'%} instead of http://localhost:8000/curr1}
What do I do to use Django way of url links made using Jquery ?
IN OTHER WORDS
I wish to do this (Dynamically using Jquery)-->
<html>
<body>
<a href='{% url "curr1" %}'>test</a>//put this duynamically using Jquery
</body>
</html>
JScode from a different resource than thetemplate.html? Otherwise, I don't see why your posted code doesn't work.