javascript - Jquery Ajax working on localhost (xammp) but not working on Server (cpanel)? -
jquery ajax working fine on localhost (xammp) not working on server (cpanel) ! ajax javascript working fine , throught jquery has problem ! (on server) changed send method post problem same.
this website : concert20.ir
an js code:
var arr=[]; function func1(id,status){ var str; var a=id.split('-'); // a[0] = chair number // a[1] = singer id // a[2] = place length=arr.length; if(status=='رزور شده') { // check resereved it? var index=jquery.inarray(parseint(a[0]), arr); if(index>=0) { // unreserved ... //arr[index]=-1; arr.splice(index, 1); length=arr.length; $.ajax({ url: 'serverreply.php', type: "get", data: ({reservefunc:0,chairnum:a[0],singerid:a[1],place:a[2]}), success: function(result){ $("#drawtable").html(result); } }); if(length==0) { $.ajax({ url: 'serverreply.php', type: "get", data: ({showdetails:0,chairnum:arr,singerid:a[1],place:a[2]}), success: function(result){ $("#card").html(result); } }); } else { $.ajax({ url: 'serverreply.php', type: "get", data: ({showdetails:1,chairnum:arr,singerid:a[1],place:a[2]}), success: function(result){ $("#card").html(result); } }); } } } else if(status=='قابل خرید') { // reserve ... arr.push(parseint(a[0])); $.ajax({ url: 'serverreply.php', type: "get", data: ({reservefunc:1,chairnum:a[0],singerid:a[1],place:a[2]}), success: function(result){ $("#drawtable").html(result); } }); sts=$("input#checksts").val(); if(sts==-1) { var index=jquery.inarray(parseint(a[0]), arr); arr.splice(index, 1); alert('این صندلی قبلا خریداری شده است'); } length=arr.length; if(length==0) { $.ajax({ url: 'serverreply.php', type: "get", data: ({showdetails:0,chairnum:arr,singerid:a[1],place:a[2]}), success: function(result){ $("#card").html(result); } }); } else { $.ajax({ url: 'serverreply.php', type: "get", data: ({showdetails:1,chairnum:arr,singerid:a[1],place:a[2]}), success: function(result){ $("#card").html(result); } }); } } }
update
found problem!
server context-sensitive , did not observe it
changed serverreply.php serverreply.php , worked fine ...
try write absolute url save versions of ulr in var , comment , un comment respectively
var mainurl = "http://localhost/project/serverreply.php" var mainurl = "http://xeample.com/project/serverreply.php"
try if can solve problem
Comments
Post a Comment