Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- define(["dojo/_base/declare","dojo/request/xhr","dojo/dom","dojo/dom-construct","dojo/on"],
- function(declare, xhr,dom,domConst,on){
- return declare(null,{
- data : [],
- constructor : function( ){
- this.getdata();
- },
- //gets Data
- getdata : function(){
- xhr("sqlaccess.php?order=0").then(function(text){
- this.prepare_str(text.toString().split(";"));});
- return this.data;
- },
- //push Data to Array
- prepare_str : function(str){
- alert(str);
- for(var index = 0; index < str.length; index++)
- {
- data.push({name:str[index], id: index});
- }
- //get
- },
- //constructor
- //Insert New Entry
- setdata : function(str)
- {
- xhr("http://localhost/sql/sqlaccess.php?order=1&val="+str).then(function(text){
- alert("Result = " + text);
- });
- },
- //update Entry
- updatedata : function(str,former){
- xhr("http://localhost/sql/sqlaccess.php?order=2&val="+str+"&former="+former).then(function(text){
- alert("Result = " + text);
- });
- },
- //Delete Entry
- deletedata : function(str) {
- xhr("http://localhost/sql/sqlaccess.php?order=3&val="+str).then(function(text){
- alert("Result = "+text);
- });
- },
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement