Trying to use jquery ajax but can't parse JSON?

ajax, javascript, jquery, json

Solution

your json string is wrong. it has to be

{"didwork":true,"userid":123}

or

{"didwork":false,"userid":0}

never use `=` and always use `"`

Problem

I'm trying to load some data via jQuery.getJSON() but it does not work: here is my JSON: ``` {didwork=true,userid=123} ``` or it is ``` {didwork=false,userid=0} ``` here is my Javascript: ``` $.ajax({ data["username"] = "u" data["password"] = "p"; url: https://www.myurl.com/json.php, dataType: 'json', data: data, success: function(json){ //fill it into div } }); ```

Original source