Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

367
Views
How to get url from django to javascript with pk

I'm having trouble to get the url from django to JavaScript. How can I get the url with pk? the error that I receive Not found: "post/(?Pslug:pk\b[0-9A-Fa-f]{8}\b(-\b[0-9A-Fa-f]{4}\b){3}-\b[0-9A-Fa-f]{12}\b)/$'

urls.py

from django.urls import path
from django.urls import reverse
from . import views
import twitter.views

urlpatterns = [
    path("chatbot/(?P<str:pk>\b[0-9A-Fa-f]{8}\b(-\b[0-9A-Fa-f]{4}\b){3}-\b[0-9A-Fa-f] {12}\b)/$'/", views.chatbot, name='chatbot_chatbot'),
    path("post/(?P<slug:pk>\b[0-9A-Fa-f]{8}\b(-\b[0-9A-Fa-f]{4}\b){3}-\b[0-9A-Fa-f]{12}\b)/$'", views.chatbot_process, name='post'),
    path("", views.landing, name='home')

]

Javascript

$.get("/post/(?P<slug:pk>\b[0-9A-Fa-f]{8}\b(-\b[0-9A-Fa-f]{4}\b){3}-\b[0-9A-Fa-f]{12}\b)/$')", {input_text: rawText, user_text: new_value}).done(function (data) {
    const msgText = data;
    appendMessage(BOT_NAME, BOT_IMG, "left", msgText);
  });
over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You can use this to get your params in your javascript

let url = new URL(window.location.href);
let pk = url.searchParams.get("pk") // Get value of parameter pk
over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!