ajax

Does Rails' Ajax support make JSON or XML an easier format to work with?

Being new to Ajax, I would like to understand which data exchange format - JSON or XML - would be easier to work with while doing Ajax in Rails. Do the various Rails helpers make one or the other format easier to deal with or does it depend on the context or does it not matter at all? ...

Could a page display diferrent content if the URL hash changes?

How could a page display different content based on the URL hash? I'm not talking about the browser scrolling down to display the anchored section, but something like JavaScript reacting to that hash and loading different content via AJAX. Is this common or even probable? ...

QUnit with Ajax! QUnit passes the failing tests!

I am looking into QUnit for JavaScript unit testing. I am in a strange situation where I am checking against the value returned from the Ajax call. For the following test I am purposely trying to fail it. // test to check if the persons are returned! test("getPersons", function() { getPersons( func...

New line characters get submitted differently

Hi, I was wondering if somebody could shed some light on this browser behaviour: I have a form with a textarea that is submitted to to the server either via XHR (using jQuery, I've also tried with plain XMLHttpRequest just to rule jQuery out and the result is the same) or the "old fashioned" way via form submit. In both cases method="P...

Process form data using jQuery

I'm currently using Prototype, but I'd like to rewrite this function to jQuery: function post(div,url,formId) { new Ajax.Updater(div, url, { asynchronous:true, parameters:Form.serialize(formId) }); } HTML example that goes with it: <form method="post" action="" id="foo" onsubmit="post('result','getdata.php','foo');retu...

Performance testing strategy web app

We recently had a web app that went out to site acceptance testing where they found severe performance problems related to request size (massive viewstate ASP.net). We need to ammend our testing strategy to include performance testing, can anyone give us guidance on best practices please? ...

Learning Ajax - where to search for online instruction.

Hello everybody. I have good knowledge in Php, Mysql, and with Stack Overflow users help i started understanding a bit more of Javascript. Which by the way thanks for all those who have helped so far. I always want learn a bit more, and I always had a little admiration for Ajax, and once in Ajax i can use Php and MySql... So i wanted ...

What might cause an XMLHttpRequest to never change state in Firefox?

I'm working on some old AJAX code, written in the dark dark days before jQuery. Strangely, it has been working fine for years, until today when it suddenly stopped firing its callback. Here's the basic code: var xml = new XMLHttpRequest(); // only needs to support Firefox xml.open("GET", myRequestURL, true); xml.onreadystatechange = fu...

Parsing xml namespaces using ajax

<item> <guid>http://jahboo.fliggo.com/video/kPZj01cs&lt;/guid&gt; <pubDate>Tue, 10 Mar 2009 18:31:38 -0500</pubDate> <title>How to be perverted with water proof cam</title> <author>Jennisita@fliggo</author> <link>http://jahboo.fliggo.com/video/kPZj01cs&lt;/link&gt; <description> This vid shows how easy it is to make perverted vids with ...

More control on ASP.Net MVC's Authorize; to keep AJAX requests AJAXy

I have some action methods behind an Authorize like: [AcceptVerbs(HttpVerbs.Post), Authorize] public ActionResult Create(int siteId, Comment comment) { The problem I have is that I'm sending a request through AJAX to Comment/Create with X-Requested-With=XMLHttpRequest which helps identify the request as AJAX. When the user is not l...

asp.net and Ajax

Hi all I am using the following javascript code to refresh another page window.opener.location.replace(url) The problem is when entering the url, do not find the page as the page is located in the root and this calling code is placed in a page inside another folder. How do I specify the path to point to the root, which is where the pag...

How to execute both the local as the global ajax events in jQuery?

Recently making the switch from Prototype to jQuery, I am struggling with some basic issues. I use several AJAX-requests in my application; for 95% of these requests, I'd like to have some global events executed, such as showing or hiding a loading indicator. Apart from the global functionality, every request should also have some custo...

How to popup when a visitor exits from a website

My company creates web surveys and once in a while I get asked if we can do an exit survey on a website. So when a visitor is about to leave the site a "popup" appears asking if they'd take a quick survey. By "popup" I'm referring to a floating CSS div, not a child window (although sometimes clients don't realise this). Is it technicall...

RadioButtonList set in PreLoad causes UpdatePanel Trigger to not fire when set back to initial value.

We had some "strange" issues when using UpdatePanels and RadioButtonLists in that a PostBack was not occuring when you changed the values. I've managed to track down the issue in that it occurs when the value of the RadioButtonList is set in the PreLoad of a page and you are re-selecting this initial value. I have the full code of the ...

Getting only a part of a file from Jquery ajax

I have some very simple sample code like this: $.ajax({ url: 'demo2.htm', success: function(loadeddata){ $("#loaded_data").after(loadeddata); alert('success'); }, error: function(){ alert('failure'); } }); Loaded data currently returns everything. What I need to is to get only a specific div and after it add it t...

ASP.Net healthMonitoring with AJAX

Currently, in all of our environments we have healthmonitoring turned on to alert us when ever a user has caused an error: <healthMonitoring enabled="true"> <providers> <add name="MailWebEventProvider" type="System.Web.Management.SimpleMailWebEventProvider" to="[email protected]" from="[email protected]" buffer="false" subjectPrefix="pr...

Encrypt part of HTML in PHP and decrypt in JavaScript

Hi, I'm looking for a way to encrypt a HTML form in PHP in a way so I can then decrypt it in the browser using JavaScript. This should work transparently to the user and JavaScript input validation must also work on the form (I know how to do this). When user submits the form, it must be encrypted again and sent to the server using an "...

rails: accessing an instance variable in a js.erb file

I am trying to access an instance variable from a js.erb file. #controller def get_person @person = Person.find(1) respond_to do |format| format.js{} end end #get_person.js.erb alert('<%= @person.last_name %>') When I browse to [controller_name_here]/get_person.js ... I get a nil object error on @person. (I know Person.find...

AJAX and how to best deal with it server side in PHP

Hi, I'm starting to write quite a few ajax heavy website, but I've never really read up on best practices and now that I want too I can't find an article that address what I want to know. What I really want to learn about is dealing with AJAX calls server side, things such as, should all data be passed back using JSON/XML,.. or is pure...

Ajax star rating resets when focus lost (jquery)

Hi Guys, I am using following code for ajax rating system jQuery.fn.rater = function(url, options) { if(url == null) return; var settings = { url : url, // post changes to maxvalue : 5, // max number of stars curvalue : 0 // number of selected stars }; if(options) { jQuery.extend(settings, ...