Just for fun I was creating a JavaScript console for controlling my PC. It involves a small webserver that takes command strings and forwards those to the system using popen calls (to be more specific popen4 on a Ruby mongrel server). The stdout channels are redirected to the http response.
The problem is that the response only arrives ...
Hello all,
I'm wanting to check a ruby session variable via ajax. I'm familiar with ajax calling php, is calling a ruby file similar?
I'm talking about a 'session[:var_name]' type variable in a Rails environment using JQuery.
Something like:
$.ajax({
url: path to ruby file,
type: "GET",
dataType: "html",
success: function(html){
.....
I have a JSON that returns from the server which tabs to build,
so I init them in my JS like this:
$('#tabs').tabs( 'ajaxOptions', {
timeout: 20000,
error: function(xhr, status, index, anchor){
console.log( status, index, anchor );
}
})
.tabs('add', item.CategoryLink, item.CategoryName);
Thing is, when I click a tab...
Hello,
Is it possible to load content from an external page (not relative) into div using jquery?
I mean here by external page is another web application like for example: http://www.yahoo.com
There is the code:
$("#externalContent").load("http://www.yahoo.com", function () {
alert("loading finish");
});
when I use firebug I got t...
Hi I was just wondering if its possible to do an ajax post a file in asp.net mvc,
basically i have a form with two buttons, one of the buttons extracts images for the selected document and displays them for the user to choose thumbnails for the document he is about to upload. The usee then fills out the rest of the form and then saves th...
Hi,
Assume i have a book entity with an isbn field.
When entered a isbn number, i want 2 fields to be updated: title and author.
My controller looks like this:
def ajaxGetBook = {
def book = Book.findByIsbn(params.isbn)
if(book==null) book = new Book()
render book as JSON
}
So my call works, and i get a f...
When I look back my codes that written earlier time, I found something terribly bad.
Whenever I want to delete a record in the database, I did like this :
$.post("deleteAction.do",{recordId:10});
I cannot prevent a malicious user visit my database operation url directly :
deleteAction.do?recordId=10
What's the solution for this ki...
I have the following code
$.ajax({type: "GET",
url: "/" + filename,
dataType: "xml",
cache: "false",
success: function(xml)
{
/* Parsing code here */
}});
In Chrome etc the requests are not cached, however they are in IE. Am I constructing my request properly?
...
I have a webpage that makes an ajax call to get some data. That data takes a long time to calculate, so what I did was the first ajax server call returns "loading..." and then the thread goes on to calculate the data and store it in a cache.
meanwhile the client javascript checks back every few seconds with another ajax call to see if th...
With a single page app, where I change the hash and load and change only the content of the page, I'm trying to decide on how to manage the JavaScript that each "page" might need.
I've already got a History module monitoring the location hash which could look like domain.com/#/company/about, and a Page class that will use XHR to get the...
Hi everybody,
I'm very new to jQuery, Ajax and things like these. I've found solutions on how to inject HTML fragments into my site:
$(document).ready(function(){
$('a').click(openContent); //binding all anchors to this function
});
function openContent(){
var path = $(this).attr('href');
$('#content').load(path);
retur...
I use the ajax which sends back a string..
I want to convert the responsetext into a json object to process.
I tried eval and also , but doesn't works...
Wht to do?
My code is
function handleResponse() {
if(httpa.readyState == 4){
var response = httpa.responseText;
if(response!='empty')
{
alert(response);
...
Is there a way to convert it into object form? So that each field of the result can be accessed results[i].field
where i is the number of records in the mysql result..
This is my JSON String
http://pastebin.com/Cky1va3K
...
Newbie ajax question from this example:
How is xmlhttp.responseText assigned before xmlhttp.open() and xmlhttp.send() ? (If we need the data from demo_post.asp)
I understand it is in the onreadystatechange but if the javascript is read from top down I do not understand. Thanks, and go easy on me!
...
Hello
I am new to JS and AJAX, but I have to do my homework. I choose jQuery, so it little easy now.
I want to get a html via AJAX request, but in result it looks, ex:
<fieldset id=\"item4\" class=\"item\"><legend>Odno\u015bnik 4<\/legend>
I set response content-type to text/html. When I outputting result on server everything is ok....
Could you confirm I understand this correctly.
However, always use POST requests
when:
- A cached file is not an option (update a file or database on the
server)
Using POST, the file specified in xmlhttp.open("POST","ajax_test.asp",true);
will not be cached (sent to \Temporary Internet Files) ? It will stay on the server...
Okay, in my first jump into AJAX-like behavior...
I'm wanting to load a div with a pdf based on a user click on a link. If the user clicks on a second link, the div should be overwritten with the new pdf.
So I figured on testing it with something like:
<script>
function showPdf()
{
var pdfDiv = document.getElementById...
Hi -
I have in my website a PHP page which retrieves data from my database to be presented in my website. This page is called via AJAX. How can I restrict the access to it only from pages within my website so users who wants to abuse it and get this data not from the website (e.g. posting HTTP request from their server) itself won't be a...
$.ajax({
type: 'GET',
url: "string.txt",
cache: false,
success: function(str){
alert("Data is: "+ str);
}
});
In this example, string.txt is sent to the cache (\Temporary Internet Files)
How do I ensure that the file is not sent. I do not want copy to be sent.
Only a read from the server. Am I missing an option?
...
I have a ASP.NET web service decorated with System.Web.Script.Services.ScriptService() so it can return json formatted data. This much is working for me, but ASP.Net has a requirement that parameters to the web service must be in json in order to get json out.
I'm using jquery to run my ajax calls and there doesn't seem to be an easy wa...