Category Archives: Ajax

Implementing Google's hashbang/Ajax crawl with ASP.NET MVC?

Questions: What are best practices for implementing Google’s hashbang/Ajax crawl pattern with ASP.NET MVC? http://code.google.com/web/ajaxcrawling/docs/getting-started.html: the crawler will modify each AJAX URL such as www.example.com/ajax.html#!key=value to temporarily become www.example.com/ajax.html?_escaped_fragment_=key=value ASP.NET’s Routing framework does not allow specifying query string parameters, but of course you can always create an action method that takes _escaped_fragment_ as a parameter… Read More »

Using Adal JS with Office 365 – multiple Ajax calls on first load

Questions: I am using Adal JS to authenticate my Html app with O365. The application is registered in Azure AD. While using the devloper tool, i noticed that breakpoint hits $.ajax({ multiple times (after callback from Azure AD). This results in multiple execution of ** .done. Am i missing something in authentication? $(document).ready(function() { (function()… Read More »

Possible collision of two ajax requests?

Questions: I’m having trouble with one of my sites on which two ajax requests are executed when the page loads. I’m using jQuery in combination with an PHP application based on the zend framework. The relevant HTML (simplified) looks like: <select id=”first”> <option value=”1″>First Option</option> <option value=”2″>Second Option</option> </select> <div class=”first_block”></div> <select id=”second”> <option value=”1″>First… Read More »

Ajax Validation Using jquery?

Questions: I using jquery validation plugin. In my form i need to check whether the nick name is already in use or not. For that they are providing remote key to make ajax call. For me the ajax call is working correctly and returning true or false. But its allowing even if the returned value… Read More »

impossible to get the responseText when 400 error

Questions: I’m working on the connection between a front-web and a rest service. I succeeded to make a cross-domain Ajax call but i’m still having a little problem. Impossible to receive the responseText when occure a 400 error. I verified with wireshark, and i’m sure the responseText was send by the REST. But when i… Read More »

Ajax driven content using CodeIgniter

Questions: I’m making an web that is a single-page website interacting with the server through Ajax in CodeIgniter. The general coding is of the following type: controller (user.php): public function get_user_content() { $id = $this->input->post(‘id’); $hits = $this->user_model->user_data($id); $s = ”; foreach ($hits as $hit) { $s .= $hit->name; $s .= $hit->age; } echo $s;… Read More »

how to respond to an ajax call in before_filter

Questions: I write a before_filter like this: def authenticate_user if request.xhr? flash.now[:alert] = ‘Error’ render :partial => “js_helpers/popover”, :formats => :js else authenticate_user! end end However, it doesn’t work as expected. The log file shows: Rendered js_helpers/_popover.js.erb (0.1ms) Filter chain halted as :authenticate_user rendered or redirected The function of the js code is to show… Read More »

crossdomain $.ajax and 302 redirection on safari

Questions: I’m having a cross-domain $.ajax call setup like $.ajax({ url : ‘http://example.com/somepage’, type : ‘get’, crossDomain : true, xhrFields : { withCredentials: true }, success : function(data) { // do something with data } }); and server side on the vhost conf SetEnvIfNoCase ORIGIN (.*) ORIGIN=$1 Header set Access-Control-Allow-Origin “%{ORIGIN}e” Header set Access-Control-Allow-Methods “post,… Read More »