ajax

Connection AJAX, CouchDB and JavaScript

Hello, i've got a little problem with AJAX, CouchDB and JavaScript. I can open the following URL from CouchDB in my browser: http://192.168.1.58:5984/mydb/name new Ajax.Request('http://192.168.1.58:5984/mydb/namee', { method: 'POST', onComplete: function(transport) { alert(transport.responseText); } }); I always get empty ...

what should I return from server side code in an ajax call

Hi guys. Lets say i have a ajax method which call a script that checks if a user exists in the database. What is best to be returned from the server side code?. Should I Just make an echo "notfound" and then compare the response in the javascript, return a json object or any other suggestion? ...

dotnetopenauth and ajax forms

I'm trying implement an openId login with Google account together with ASP.NET MVC 2 framework and DotNetOpenAuth library. The following code is used to render login button: <% using (Html.BeginForm("LogOnPostAssertion", "Authentication", FormMethod.Post, new { target = "_top" })) { %> <%= Html.AntiForgeryToken() %> <%= H...

Twisted.Web and AJAX

I've implemented a toy web service in Twisted.Web: from twisted.web import server, resource, http class RootResource(resource.Resource): def __init__(self): resource.Resource.__init__(self) self.putChild('test', TestHandler()) class TestHandler(resource.Resource): isLeaf = True def __init__(self): res...

Ruby object in my JavaScript file

I have a Ruby object and I want to use that object in JavaScript. I haven't seen that type of thing, but I want a Ruby object in my .js file. Is this possible? Thanks in advance ...

What are some best practices when using jquery for AJAX calls in ASP.NET?

Recently I have been working on project that heavily relies on AJAX calls. In the past most of these calls have been using there own aspx page to post to eg. AJAXgetResults.aspx. After doing some research I saw some examples using jquery's .ajax function and webmethods in the codebehind. I guess my question boils down to. Is there an...

Ajax auto refresh & javascript

I have a page which reloads a DIV with AJAX every 5 seconds. I also have an AJAX sorting script (you can see it here). The sorting script works great when I visit the page for first time, but when the page is refreshed it doesn't work. Am I doing something wrong? I have the sorting script in the HEAD tag, and the refresh on the bottom b...

ASP.NET MVC AJAX with HTML.ValidationMessageFor

Hello, I'm used to the ASP.NET Webforms easy way of doing AJAX with UpdatePanels. I understand the process is much more artisanal with MVC. In a specific case, I'm using Data Annotations to validate some form inputs. I use the HTML.ValidationMessageFor helper to show an error message. If I want to use AJAX to post this form and show thi...

updatepanel loads whole page inside a iframe

Hi I have a page that shows inside an iframe. The iframe uses an UpdatePanel Ajax control to update a form inside it. However the whole page refreshes in IE although Firefox is fine. The validators dont wotk either. My code (with Ajax) works outside the iframe. What's happening? Thanks for your help. My code is: container page: <I...

Fancybox jQuery ajax on success bind form Submit

Hi, is there a way to bind the "submit" to the fancybox after success? Here's what I have: <div class="ta_l" id="tell_friend"> <form id="form_tell_friend" method="post" action=""> <table cellspacing="0" cellpadding="0" border="0" class="tbl_insert mr_b0"> <tbody> <tr class="tell_frie...

Call a view with ajax inside jquery file

I have a jquery file from which I'd like to call a view. The action at the controller is called Inbox. What is the right way to call this action from the jquery file? ...

CascadingDropDown onchange handler

Is it possible to use an jQuery change() handler with an ASP.NET AJAX CascadingDropDown? I'd like to change the value of another dropdown on the page, which is unrelated to the cascading behavior. The following never executes: $('#<%= ddlFromCompetition.ClientID %>').change(function() { $('#<%= ddlToCompetition.ClientID %>').value = $...

Using AJAX to create a Gmail style star favourite icon

I'm trying to recreate the Gmail 'star' favourite button using AJAX. Unfortunately what I have isn't working and I can't work out why. I have the following in my HMTL: <img id="item_1" src="/_images/star_off.gif" onclick="updateStar(this.id)" /> <img id="item_2" src="/_images/star_off.gif" onclick="updateStar(this.id)" /> And I'm usi...

PHP json_encode unread by jQuery AJAX Post

I'm posting from a form to a URL like so: $.post('?class=articles&method=submit', $(this).serialize(), function(msg) { alert(msg); $(msg.html).hide().insertBefore('#addCommentContainer').slideDown(); $('#body').val(''); },'json'); And in the 'submit' method the last line is: print json_encode( array('html'=>$content) ); ...

Populate textbox from checkbox list using ASP.NET and AJAX

I have a textbox control and a checkbox list control on my page. I am first populating my checkbox list with a list of employee objects in the code-behind. An employee has an id and a name. Both are displayed in the checkbox list like so: Jim (1) Alex (2) Gary (3) When a user checks one of the boxes, the employee's name needs to be ...

Dynamically creating a json index won't let me access the data within

I'm trying to use jQuery to send an ajax request to a very simple PHP script to load images for the jQuery cycle plugin. I'm having an issue with obtaining the image source strings from my json object. I'll show my code, then go into more detail below: <!doctype html> <html lang="en-us"> <head> <title>jQuery Cycle test</ti...

How do I read what is returned via $.ajax()?

I don't receive an alert even though this successfully returns the model I'm requesting? function editaddress(id) { $.ajax({ type: "POST", url: "/Address/Edit/" + id, success: function (msg) { alert(msg); } }); } What is msg? I thought it was maybe a J...

Weird Bubbling Issue

I'm not sure why this is bubbling, but it is. Wondering if anyone has any ideas? $('#file_upload').live('submit',function(event){ $('#file_upload').attr('action','io.cfm?action=updateitemfile&item_id='+$('.agenda-modal').attr('data-defaultitemid')); $('iframe').load(function(){ $('.upload_output').empty(); ...

Using jQuery AJAX to call ASP.NET function in control code-behind instead of page code-behind

I have a user control that I'm creating that is using some AJAX in jQuery. I need to call a function in the code-behind of my control, but every example I find online looks like this: $("input").click(function() { $.ajax({ type: "POST", url: "Default.aspx/GetResult", data: "{}", contentType: "applica...

Batch translating with Google Language API

I am trying to utilize Google's AJAX Language API to translate each value in an array. for(var n=0; n < mytext.length; n++) { google.language.translate(mytext[n], originalLanguage, newLanguage, function(result){ if(!result.error){ document.getElementById("caption") += mytext[n]+" has been translated to "+result.translation; } ...