Ushahidi and jsonp


#1

After speaking with a colleague I wanted to venture a bit with html5 and mobile.

It would be interesting to experiment with js and Ushahidi.

At one point I was stuck with cross domain requests.

My app is a simple js that is copied to the phone and stop.

I thought so but you could make Ushahidi JSONP API?

Unfortunately I have no great knowledge of Kohana and so I use grep ...

I edited Api_Object.php

(in a brutal way)


protected function array_as_json($data)

{

if(isset($this->request))

{

return $this->request . '(' . json_encode($data) . ')';

}

else

{

return json_encode($data);

}

}


then i write 10 line of js and jquery for testing:





















and everything works.

This would moreover loose my app from the domain and the server hosting such as Ushahidi and put on some html5 store.

You can think about of making the Ushahidi api JSONP? Other services do it (eg twitter).

I know there are some safety considerations to be done but since the spreading of html5 in the mobile world and self-contained app js + html not hurt.



#2

HI Micheg, there are a few Ushahidi team and community members playing with HTML5. They are collaborating via skype.

Ping me and I can introduce you: Contact us

Heather


#3

Hi Micheg,

We have added support for Jsonp and so should expect it in the next release due in a couple of weeks i.e 2.6