You need to capture parameters in your path definition if they are part
of the url.
Something like path('/get_courts/<pkid>/', views.get_courts,
name="reg4_getcourts')
Best regards,
Javier.
O 10/07/19 ás 08:57, johnf escribiu:
Hi,
In my app folder I have a view.py which contains a function "def
get_courts(pkid)"
In my app folder url.py I have :
path('/get_courts/', views.get_courts, name = 'reg4_getcourts')
In my app ->template->html file I have:
function countySelected(){
var countyId = $("select[name=County]").val();
$.ajax({
url: "/get_courts/" + countyId,
dataType: "json", ...
I get the following error:
"GET /get_courts/47 HTTP/1.1" 404 3221"
So the question is what is the correct url I should be using in the
html file. Here is my tree:
pesweb
│ ├── __init__.py
│ ├── pesweb3.wpr
│ ├── pesweb3.wpu
│ ├── __pycache__
│ │ ├── __init__.cpython-36.pyc
│ │ ├── settings.cpython-36.pyc
│ │ ├── urls.cpython-36.pyc
│ │ └── wsgi.cpython-36.pyc
│ ├── settings.py
│ ├── urls.py
│ └── wsgi.py
└── register
├── admin.py
├── apps.py
├── AuthNet.py
├── ccProcess.py
├── creditcard.py
├── forms.py
├── __init__.py
├── migrations
│ ├── __init__.py
│ └── __pycache__
│ └── __init__.cpython-36.pyc
├── models.py
├── __pycache__
│ ├── admin.cpython-36.pyc
│ ├── apps.cpython-36.pyc
│ ├── ccProcess.cpython-36.pyc
│ ├── creditcard.cpython-36.pyc
│ ├── forms.cpython-36.pyc
│ ├── __init__.cpython-36.pyc
│ ├── models.cpython-36.pyc
│ ├── urls.cpython-36.pyc
│ └── views.cpython-36.pyc
├── static
│ ├── css
│ │ ├── bootstrap-datetimepicker.min.css
│ │ ├── bootstrap.min.css
│ │ ├── bootstrap-theme.min.css
│ │ ├── calendar.png
│ │ ├── changenavbar.css
│ │ ├── jquery-ui.css
│ │ ├── main.css
│ │ ├── sprites.css
│ │ ├── theme.css
│ │ └── themes.png
│ ├── fonts
│ │ ├── glyphicons-halflings-regular.eot
│ │ ├── glyphicons-halflings-regular.svg
│ │ ├── glyphicons-halflings-regular.ttf
│ │ └── glyphicons-halflings-regular.woff
│ ├── img
│ │ └── favicon.ico
│ └── js
│ ├── additional-methods.js
│ ├── bootstrap-datetimepicker.min.js
│ ├── bootstrap.min.js
│ ├── docs.min.js
│ ├── jquery.maskedinput.min.js
│ ├── jquery.min.js
│ ├── jquery-ui.min.js
│ └── jquery-validate.min.js
├── templates
│ └── register
│ ├── about_start.html
│ ├── base.html
│ ├── finished.html
│ ├── home.html
│ ├── navbar.html
│ ├── reg1.html
│ ├── reg2.html
│ ├── reg3.html
│ ├── reg4.html
│ └── rejected.html
├── tests.py
├── urls.py
└── views.py
Thanks in advance,
Johnf
--
You received this message because you are subscribed to the Google
Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send
an email to django-users+unsubscr...@googlegroups.com
<mailto:django-users+unsubscr...@googlegroups.com>.
To post to this group, send email to django-users@googlegroups.com
<mailto:django-users@googlegroups.com>.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/6a94b889-2813-a8de-48b5-e513c178ac38%40jfcomputer.com
<https://groups.google.com/d/msgid/django-users/6a94b889-2813-a8de-48b5-e513c178ac38%40jfcomputer.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Django
users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to django-users+unsubscr...@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit
https://groups.google.com/d/msgid/django-users/9c0fe7a9-eaea-598c-2c20-11cb5fef3846%40castroparga.com.
For more options, visit https://groups.google.com/d/optout.