Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

181
Vistas
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);
  });
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

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
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda