I am trying to make a simple ajax request to a view but keep having a not Found error for the given url:

```
Not Found: /myapp/start_session/1/scan_ports/
"POST /myapp/start_session/1/scan_ports/ HTTP/1.1" 404 5711

```

**js**

```
$(document).ready(function() {
        $.ajax({
            method: 'POST',
            url: 'scan_ports/',
            data: {'csrfmiddlewaretoken': '{{csrf_token}}'},
            success: function (data) {
                 alert("OK!");
            },
            error: function (data) {
                 alert("NOT OK!");
            }
        });
    });

```

**url**

```
url(r'^scan_ports/$',views.ScanPorts,name='scan_ports'),

```

**view**

```
 @login_required
    def ScanPorts(request):
        user = request.user
        if request.method == 'POST':
            currentSetting = models.UserSetting.objects.filter(isCurrent=True)
            if currentSetting.serialPort:
                print("GOT IT!")
            return HttpResponse('')

```

Is the ajax request not set properly?