Question: I created a form in Django as follows:

```
class advancedsearch(forms.Form):
    choices = forms.ChoiceField (label="choices", choices = ("1", "2", "3"), required= False)

```

Now I'm trying to use this in a view as follows:

```
def advancedsearch(request):
    # if request.method == "POST":
    #   search = advancedsearch(request.POST, request.FILES)
    #   if search.is_valid():
    #       return HttpResponseRedirect(reverse("view.designs")) #    UPDATE REDIRECT
    #   else:
    #       print "FORM IS NOT VALID"
    #     # GET request
    # else:
    #   search = advancedsearch()
    #   return render_to_response("advancedsearch.html", {
    #       "search": search,
    #       }, context_instance=RequestContext(request,{}))
    # # generic case
    search = advancedsearch()
    return render_to_response("advancedsearch.html", {
        "search": search,
        }, context_instance=RequestContext(request, {}))

```

The error I am getting is `advancedsearch() takes exactly 1 argument (0 given)`

I didn't think I needed to pass an argument to the function -- but it looks like I do...What should I be passing it?

Answer: 
If you are using jQuery to get this JSON data, you don't need to worry about parsing it. jQuery can (and sometimes will) do it for you.

Your problem is (probably) that it is already being parsed for you. If you server returns the `Content-type: application/json` header, jQuery will parse it for you. If it returns a different header, like `text/html`, then it won't be parsed as JSON. It's never good to be unsure of what a variable contains.

To tell jQuery to always parse it as JSON, use `dataType: 'json'`. This makes sure that the data in your callback is *always* an object.

```
$.ajax({
    url: 'file.php',
    dataType: 'json',
    success: function(data){
        var results = data.query.results.quote;
    }
});

```
You can use the official implementation of JSON by Douglas Crockford. It's available [here](https://github.com/douglascrockford/JSON-js). Major libraries make sure to add JSON functionality. It is also very easy to check if a native implementation of JSON is available within the existing browser.

The JSON library already does that. It checks to see if the browser already has `JSON.parse` and `JSON.stringify` implemented. If it does, it won't override anything. If it doesn't it will give you the functionality you need.