<div id="callback">
<form ....>
.....
</form>
</div>
$(function() {
function ajaxForm(BlockID) {
if ($('#' + BlockID + ' form:first').length > 0) {
$(document).on('submit', '#' + BlockID + ' form:first', function () {
var data = $(this).serialize();
$.ajax({
data: data,
type: "post",
url: document.location.href,
success: function (answer) {
var start = answer.indexOf('<body');
var end = answer.indexOf('</body>')+7;
answer = answer.substring(start, end);
answer = $(answer).find('#' + BlockID).html();
$('#' + BlockID).html(answer);
}
});
return false;
})
}
}
ajaxForm('callback');
});
def create
@image = Image.new(image: params[:image])
if @image.save
respond_to do |format|
format.json{ render :json => @image }
end
else
render json: @image.errors
end
end
<!--[if lt IE 7 ]> <html class="ie6"> <![endif]-->
<!--[if IE 7 ]> <html class="ie7"> <![endif]-->
<!--[if IE 8 ]> <html class="ie8"> <![endif]-->
<!--[if IE 9 ]> <html class="ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html> <!--<![endif]-->
.ie9 .button {
disblay:block;
}
get '../:category_url/:project_url', to: 'project#category'
Поднять выше в коде, чем другие варианты, тогда у этого будет выше приоритет.get '*url' => 'project#show'
raise ActionController::RoutingError.new('Not Found')
ну и дальше по списку. $.ajax({
...
beforeSend:function(){
$('#loading').hide();
},
success: function(answer) {
$('#loading').hide();
}
})
$_SESSION['flash_message']='Ваша заявка принята, ожидайте ответа';
if ($_SESSION['flash_message']){
echo $_SESSION['flash_message'];
unset($_SESSION['flash_message']);
}