I have a rails application that requests cross domain (I use rack-cors to execute this cross domain request without jsonp) through this ajax: it responds with html
$.ajaxPrefilter('script', function(options) {
options.cache = true;
});
$.ajax({
beforeSend: function (xhr) {
xhr.setRequestHeader ('Authorization', api_key);
},
dataType: 'html',
type: 'GET',
url: url+'/gwsearch/ajax_search?d1='+d1_val+'&d2='+d2_val,
crossDomain: true,
success:function(result){
$("#display").html(result);
},
error: function(result) {
$('#display').html('Unauthorized client.');
}
It responds with the HTML that is displayed in #display. It has this script tag included in html
<script src="http://localhost:3000/assets/application.js" type="text/javascript"></script>
I have input buttons in a new displayed rails application, they look like this:
<%= form_tag plans_collapse_plans_path, :method => 'post', :remote => true do %>
<%= hidden_field_tag(:plangroup_id, plangroup.id) %>
<%= image_submit_tag "collapse.png" %>
<% end %>
Pressing the enter button performs POST. The problem is that the enter button will POST as many times as I asked for the cross-domain application. If I asked the application 5 times, when I press the enter button in the application, it will POST 5 times.
, ajax, application.js; .
EDIT: , , , application.js:

collapse_tplans POST application.js, . ajax 6 , 6 POST- collapse_tplan application.js

, script html- jquery ( jquery application.js), , , , . js , script. , " Chrome", application.js , , ajax.
? POST , . .