Part 1: Add two practical functions
1. added the data attribute and request parameters.
2. added the scope attribute so that the callback function can be executed in the specified context.
The interface is as follows:
View sourceprint? 1 Sjax. load (url ,{
2 data // request parameter (key-Value Pair string or js object)
3 success // callback function after successful
4 scope // callback function execution Context
5 timestamp // whether to add a timestamp
6 });
Example
View sourceprint? 01 <! Doctype html>
02
03
04 <meta charset = "UTF-8">
05 <title> sjax_0.2.js by snandy </title>
06 <script src ="Http://files.cnblogs.com/snandy/sjax_0.2.js> </script>
07
08 <body>
09 <input type = "button" value = "Get Name" onclick = "clk ()"/>
10 <script type = "text/javascript">
11 function clk (){
12 Sjax. load (http://files.cnblogs.com/snandy/jsonp.js ,{
13 fn: function () {alert (jsonp. name )},
14 data: {a: 1, B: 2, c: [11,22]},
15 timestamp: true
16 });
17}
18 </script>
19 </body>
20