2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
# File 'lib/red_query/ajax.rb', line 2
def self.request(options)
options[:data] = options[:data] || {}
params = options[:data].to_query_string
success_callback = Proc.new { |text| options[:success].call(String.new(text)) }
error_callback = Proc.new { |msg| options[:problem].call(String.new(msg)) }
`jQuery.ajax({
url:#{options[:url]}.__value__,
type:#{options[:method]}.__value__,
data:#{params}.__value__,
success: function(msg) { return #{success_callback}.m$call(msg); },
error: function(xhr,msg) { return #{error_callback}.m$call(msg); }
})`
end
|