Ajax call to the whole page

Ok that worked. Can you explain if you dont mind these 2 things…

  1. Data exist until end of what function?
  2. Why blocking data type:JSON makes this work

Have you got any spaces before your <? in the PHP file? Or blank lines after the ending ?> ?
The response is saying that what you’ve sent isnt JSON.

                success : function(data){
                   console.log("Success");
                },

data stops existing at that }.

                success : function(data){
                   console.log(data);
                },

No I dont have any spaces or lines after opening and closing PHP

How would I access this value rev_id

if data has actually been returned as a proper object,
data.result[0].rev_id

ok I think I am getting somewhere…
I had to change this…

echo "{'result':".json_encode($r)."}";

to this…

echo json_encode($r);

to get this…

Interesting. The browser should have actually rejected that as being not-JSON (because JSON by definition must start with a { ) but… whatever works i guess. at that point, data[0].rev_id would be your accessor.

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.