Skip to content

Instantly share code, notes, and snippets.

@galpratama
Created November 6, 2015 12:46
Show Gist options
  • Save galpratama/730778e235333d1984eb to your computer and use it in GitHub Desktop.
Save galpratama/730778e235333d1984eb to your computer and use it in GitHub Desktop.
Rating User UGo
// Rating Submit by User
$('#ratingForm input').on('change', function() {
var button = $(this).find(".rtg");
var data = new FormData();
data.append('id', $('input[name=shopID]', '#ratingForm').val());
data.append('rate', $('input[name=rating]:checked', '#ratingForm').val());
button.prop("disabled", true);
console.log($('input[name=rating]:checked', '#ratingForm').val());
$.ajax({
cache : false,
contentType : false,
processData : false,
url : $("#ratingForm").attr("action"),
type : "POST",
data : data,
success : function(data) {
var obj = $.parseJSON(data);
if(obj.status == 200) {
alert('success');
} else {
alert(obj.message);
}
}
})
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment