今天弄下所谓的ajax

jquery原生实现:

[sourcecode]






This is id paragraph.


[/sourcecode]

haxe实现:

[sourcecode]

package ;

import js.JQuery;
import js.Lib;
/**
* ...
* @author amyflash.com
*/

class Main
{

static function main()
{
new JQuery(null).ready
(
function(e:JqEvent)
{
var domElem = new JQuery("button");
var clickHandlerFunction = function (e)
{
var d = new JQuery("p");
d.load('data.json');
}
domElem.bind( "click", clickHandlerFunction );
}
);

}
}

[/sourcecode]

对应的data.json:

[sourcecode]

{ "firstName": "Brett", "lastName":"McLaughlin", "email": "aaaa" }

[/sourcecode]

对应的index.html

[sourcecode]





myjquery


This is id paragraph.




[/sourcecode]