title: How to use django url in ajax?
body: <p>How to call django function using ajax with id (or pk).</p>
  
  <pre><code> $.ajax({
      url: '{% url  app:order_edit %}',
      type:"POST",
          async:false,
      data: {order:order, product:product, customer:customer, qty:qty, uom:uom, des:des},
        success:function(data){
        }
  });
  </code></pre>
  
  <p>views.py</p>
  
  <pre><code>def order_edit(request, obj_id):
      print("Obj Id is:",obj_id)
      if request.method == 'POST':
          form = OrderForm(request.POST)
          if form.is_valid():
              #operations
              return render(request, 'order_view.html', {'form': form})
          return render(request, 'order_view.html', {'form': form})
      return render(request, 'order_view.html', {})
  </code></pre>
  
  <p>urls.py</p>
  
  <pre><code> path('orderedit/&lt;int:obj_id&gt;/', views.order_edit, name="order_edit"),
  </code></pre>
  
  <p>how to call this function Anyone Help me in this issu. Thanks in advance</p>