Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function save($data)
- {
- $allData = load();
- array_push($allData, $data);
- global $filePath;
- $fp = fopen($filePath, 'w+') or die("I could not open $filePath.");
- fwrite($fp, serialize($allData));
- echo "{status:"success" , result:" . (string)(count($allData) - 1) . "}";
- fclose($fp);
- }
- $jQuery.ajax({
- url: serverUrl,
- type: "GET",
- data: {method: "save", data: jQuery.param(pData)},
- cache: false,
- success: function (data) {
- alert("data");
- }
- });
- echo '{"status": "success", "result": "'. (string)(count($allData) - 1) .'"}';
- alert(data.status);
- $jQuery.ajax({
- url: serverUrl,
- type: "GET",
- data: {method: "save", data: jQuery.param(pData)},
- dataType: 'json', //added by me
- cache: false,
- success: function (data) {
- alert("data");
- }
- });
- $var = array('status' => 'success', 'result' => count($allData) - 1 );
- echo json_encode($var);
Add Comment
Please, Sign In to add comment