-
-
Save romreed/58f00b57273a68c708cd to your computer and use it in GitHub Desktop.
Ajax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
index.js | |
$('.Types').click(function(e) { | |
e.preventDefault(); | |
/*var name = this.attr('name'); | |
console.log(name);*/ | |
$(this).addClass('active'); | |
name=$('.active').attr('name'); | |
$(this).removeClass('active'); | |
data='type='+JSON.stringify(name); | |
$.ajax({ | |
url:'http://reed.pe.hu/work1/preorder.php', | |
type:'post', | |
dataType:'json', | |
data:data, | |
success:function(data){ | |
console.log(data); | |
}, | |
error:function(data){ | |
// console.log('bad'); | |
}, | |
complete:function(){ | |
} | |
}); | |
return false; | |
preorder.php | |
echo (json_decode($_POST["type"])); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment