Search Results

Search found 8063 results on 323 pages for 'ajax'.

Page 32/323 | < Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >

  • AJAX with Ruby on Rails?

    - by Zachary
    This is probably a really dumb question with a simple answer but... I am working on a project where I need to use AJAX to send/receive information. I am using Ruby on Rails (which I am pretty new to), but rather than using the helper methods or the built in functionality in the 'defaults' Javascript file, I need to do this manually in my own Javascript. I believe that ultimately I will want to send a request with a JSON object, then have the controller return another JSON object containing the requested information. The problem is that I cannot seem to find the syntax for sending something to a specific controller method, with parameters, directly from Javascript - everything I Google ends up being tutorials for using the Rails AJAX helper methods.

    Read the article

  • jQuery ajax inside a loop problem

    - by steamboy
    Hello, This js loop script always get the last value of ui_item inside a jquery ajax funciton. How can a catch the correct value of each iteration? for (var i = 0; i <= split_files_cb_value_holder.length - 1; i++){ var split_values = split_files_cb_value_holder[i].split(':'); ui_item = split_files_cb_value_holder[i]; $.ajax({ type: "POST", url: "ds/index.php/playlist/check_folder", data: "component_type="+$('#component_type').val()+"&value="+split_values[1], success: function(msg) { console.log(ui_item); //ALWAYS GETS THE LAST VALUE }, error: function() { alert("An error occured while updating. Try again in a while"); } }); } Thanks!

    Read the article

  • Django and ajax image file upload errors and csrf

    - by sharkfin
    I tried out Alex Kuhl's ajax script to upload images to Django 1.4. My first question is why I'm getting an empty page with firebug telling me I have two errors: fileuploader.js (line 4): syntax error <!DOCTYPE html> In my template html: qq is not defined var uploader = new qq.FileUploader( { Here is my entire html file for it: http://pastebin.com/NjbV5gMn This post suggests that either some script has 404'd or the src attribute is empty, which would cause the doctype error. But that doesn't seem to be the case here. As for why qq is not defined, I'm not sure what is wrong. Django can clearly find the fileuploader.js just fine from my static folder. My second question is why the ajax code uses {{ csrf_token }} instead of {% csrf_token %}. But if I use {% csrf_token %}, I get the firebug error: missing } after property list 'csrf_token': '<div style='display:none'<input type='hidden' name='csrfmiddlewaretoken' value='Cx0zFFak6OLgrHiAnFa3k4BPDmn4BgoT' /</div',

    Read the article

  • Ajax dynamic content from .aspx page

    - by Nano
    Hi, I'm using this Ajax script (http://www.dhtmlgoodies.com/index.html?whichScript=ajax-dynamic-content) to load content from an aspx page on another server than the page calling the content. So far I've learned that this is a no go. The problem seems to be that when using an absolute link to content the script fails as apposed to using a relative link. I've searched the web for about 10 hours now, and I still haven't found what I'm looking for. I'm in need of some expert help here. Appreciate any help. Best regards Nano

    Read the article

  • jQuery.Ajax makes the wrong request with array data

    - by user46503
    Hello, I have the following array: var idParam = ["1","2","3"]; I want to send this data as request using jQuery.ajax, what I'm doing: $.ajax({ type: "GET", url: "Services/GetInfo.ashx", data: { "id": idParam }, contentType: "application/text", dataType: "json", success: function(result) { ... }, error: function(XMLHttpRequest, textStatus, errorThrown) { ... } }); But as result I have the following ugly string: ?id[]=1&id[]=2&id[]=4 (actually it's much uglier:id%5B%5D=1&id%5B%5D=2&id%5B%5D=4). What to do to get the normal string like: id=1&id=2&id=4 ?? Thanks

    Read the article

  • jquery ajax success problem

    - by oshirowanen
    Why is it that the following script works clientside by removing the relievant html entity: $(".ui-delete").click(function() { $.ajax({ url: 'delete.aspx', type: 'POST', data: { strWidgetID:$(this).parents(".widget").attr("id") }, error: function() { alert('Error'); }, success: function() { alert('Success'); } }); $(this).parents(".widget:first").remove(); }); But the following query which is "more proper", does not work by removing the html entity? $(".ui-delete").click(function() { $.ajax({ url: 'delete.aspx', type: 'POST', data: { strWidgetID:$(this).parents(".widget").attr("id") }, error: function() { alert('Error'); }, success: function() { alert('Success'); $(this).parents(".widget:first").remove(); } }); }); The first script does both clientside and serverside correctly, the second script does serverside correctly, but on clientside, it just displays an alert "success", but does not remove the html entity "widget" Any ideas?

    Read the article

  • Trigger a form submit from within an AJAX callback using jQuery

    - by Yarin
    I want to perform an ajax request right before my form is submitted. I want to trigger the form submit from my ajax callback, but when I try to trigger the submit, I get the following error: Uncaught TypeError: Property 'submit' of object # is not a function Here is the entire code: <form method="post" action="http://www.google.com" > <input type="text" name="email" id="test" size="20" /> <input id="submit" name="submit" type="submit" value="Submit" /> </form> <script> function do_ajax() { var jqxhr = $.get("#", function(){ $('form').submit(); }); } $(function() { $('#submit').click(function (e) { e.preventDefault(); do_ajax(); }); }); </script> Stumped.

    Read the article

  • cannot display json data returned from jquery ajax call

    - by amby
    Hi, can somebody please tell me, how can I display json data returning from the ajax call. I am new to this. $.ajax({ type: "POST", dataType: 'JSON', //data: "{'ntid':'john'}", //contentType: "application/json; charset=utf-8", //processData: false, url: "Testing.aspx/SendMessage", error: function(XMLHttpRequest, textStatus, errorThrown) { alert(textStatus); }, success: function(result, txtStatus, httpRequest) { alert(txtStatus); the_object = result; $('#status').html(concatObject(the_object)); } above is the js file. should i need to do something on asp file directly to display it. if yes, then how? please reply me soon. i m stuck here and unable to display data here

    Read the article

  • django: ajax view structure

    - by zack
    I want to know the correct way to structure ajax views in django. say i do something like : def foo_json(request): if is.ajax(): # return JSON here and make it available as a resource at something like '/foo/data/'.. all is fine.. but if I point the browser at '/foo/data/' .. obviously I get an error (debug) like: app.views.foo_json didn't return an HttpResponse object. so... my question is: Whats the best way structure this kind of view? ..should I return an HTTP response code ..maybe 404 / 405 ... or something else? - not sure of the best way to handle this, any advice appreciated :)

    Read the article

  • post data to a thickbox using ajax

    - by sqlchild
    I need to post data to a thickbox using ajax and open it immediately and display the posted data. The user would click on a link/button and the data i.e. value of the selected checkboxes would be posted to "my_thickbox.php" and the thickbox (url : my_thickbox.php) would open with checkbox values displayed. <div id="showthickbox" ><a href="my_thickbox.php" class="thickbox"></div> $('#showthickbox').click(function() { var data = $('input:checkbox:checked').map(function() { return this.value; }).get(); $.ajax({ type: 'POST', url: 'my_thickbox.php', data: data, success: success, dataType: dataType }); });

    Read the article

  • Question about AJAX

    - by Doug
    function showHint(str) { if (window.XMLHttpRequest) { xmlhttp=new XMLHttpRequest(); } else { xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("games").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","hw9.database.php?name="+str,true); xmlhttp.send(); } I'm learning AJAX at the moment. The code here basically receives the echo from the PHP and then puts it in element id games. My question is, if I wanted to have AJAX send 3 different http requests to 3 different PHP scripts and if I wanted to retrieve data from each one and then put it in 3 different element id's then would I make 3 copies of this same function? I would imagine that there should be a more efficient way. Thanks!

    Read the article

  • How to use xml response as XMLObject outside of ajax callback function

    - by Anthony
    Hopefully I've just made a dumb oversight, but I can't figure out why the following doesn't work: $(function() { var xml; $.get( "somexml.xml", function(data){ xml = data; }, "xml"); alert(xml); }); If I put the alert inside of the callback function, I get back object XMLdocument but if I place it outside of the ajax call, I get undefined. Since my goal is to have a new DOM to parse, I don't want the entire handling of the XMLdocument to be within the callback function. I've tried defining the variable outside of the entire onready function, inside at the top (like above) and inside the callback function, all with no luck. According to Specifying the Data Type for Ajax Requests in the jquery documentation, this should be possible.

    Read the article

  • How to handle model state errors in ajax-invoked controller action that returns a PartialView

    - by Robert Koritnik
    I have a POST controller action that returns a partial view. Everything seems really easy. but. I load it using $.ajax(), setting type as html. But when my model validation fails I thought I should just throw an error with model state errors. But my reply always returns 500 Server error. How can I report back model state errors without returning Json with whatever result. I would still like to return partial view that I can directly append to some HTML element. Edit I would also like to avoid returning error partial view. This would look like a success on the client. Having the client parse the result to see whether it's an actual success is prone to errors. Designers may change the partial view output and this alone would break the functionality. So I want to throw an exception, but with the correct error message returned to the ajax client.

    Read the article

  • AJAX response inside jqplot not working

    - by JuanGesino
    I'm trying to render data from an AJAX response as a bar chart with jqplot. To render this bar chart I use two variables: s1 which contains the numbers ex: s1 = [22,67,32,89] ticks which contains the name corresponding to a number inside s1 ex: ticks = ["Jack", "Mary", "Paul", "John"] So my AJAX returns two variables, data1 and data2. When I console.log(data1) I get 22,67,32,89 When I console.log(data2) I get "Jack", "Mary", "Paul", "John" I then add the square brackets and change variable: s1 = [data1] ticks = [data2] When I console.log(s1) I get ["22,67,32,89"] When I console.log(ticks) I get "Jack", "Mary", "Paul", "John" And the graph does not render, this is my code: s1 = [data]; ticks = [data]; plot4 = $.jqplot('chartdiv4', [s1], { animate: !$.jqplot.use_excanvas, series:[{color:'#5FAB78'}], seriesDefaults:{ renderer:$.jqplot.BarRenderer, pointLabels: { show: true } }, axes: { xaxis: { renderer: $.jqplot.CategoryAxisRenderer, ticks: ticks }, yaxis:{min:0, max:100, label:'%',labelRenderer: $.jqplot.CanvasAxisLabelRenderer} }, highlighter: { show: false } }); });

    Read the article

  • AJAX response not valid in C++ but Apache

    - by fehergeri
    I want to make a server written in C++ to power my game. I learned the basics of sockets and wrote a basic chat program that worked well. Now I want to create an HTTP server like Apache, but only for the AJAX request-response part. I think just for the beginning i copied one Apache response text, and i sent the exact response with the C++ server program. The problem that is that the browser (Firefox) connnects to the apache and everything works fine, except all of the requests get a correct response. But if i send this with the C++ client, then FireBug tells me that the response status is OK (200) but there is no actual response text. (How is this possible?) This response-text is exactly the same what apache sends. I made a bit-bit comparison and they were the same. The php file wich is the original response <?php echo "AS";echo rand(0,9); ?> And the origional source code: Socket.h http://pastebin.com/bW9qxtrR Socket.cpp http://pastebin.com/S3c8RFM7 main.cpp http://pastebin.com/ckExuXsR index.html http://pastebin.com/mcfEEqPP < this is the requester file. ajax.js http://pastebin.com/uXJe9hVC benchmark.js http://pastebin.com/djSYtKg9 jQuery is not needed. The main.cpp there is lot of trash code like main3 and main4 functions, these do not affect the result. I know that the response stuff in the C++ code is not really good because the connection closing is not the best; I will fix that later now I want to send a success response first. UPDATE: now i tested today a lot again and i find out there is no problem with the socket. I used the fiddler program to capture the the good answer and to capture the bad. They were the same. After this i turned off my socket application, and forced fiddler to auto respond, and the answer from the 'bad' answer still bat. So after that i replaced the bad with the good and nothing happedned. The bad answer with the good text still bad on the :8888 port but the other on the original :80 port was good, but they were absolutly the same and the same program sended it (fiddler) i think there is something missing if the response is not on the same server address (even not the same port). UPDATE: oh my god! i cant send ajax request to a remote server. now i know this.

    Read the article

  • Programatically prevent ASP .NET AJAX scripts from rendering

    - by cbp
    Does anyone know of a way that I can stop all the .NET AJAX scripts from rendering, even if a ScriptManager exists on the page? The ScriptManager's Visible property has been overridden and disabled so that you receive a NotImplementedException if you try to set the Visible property. The reason I would like to do this is that I don't want these large chunks of javascript all over my pages when they are not required. The ScriptManager needs to be included on the master page to ensure that only one ScriptManager is added, but it would be stupid to to have to have two versions of the same master page - one ajax enabled and one not. Edit: I am actually using Telerik's RadScriptManager with RadAjax, in case anyone knows a method using these classes instead.

    Read the article

  • Dojo and Ajax - rendering widgets

    - by Michael Merchant
    I'm trying to load content into a Dojo content pane in a specific html tag and not replace the entire content pane. The html I'm loading includes a markup defined widget that I'd like to have rendered when the new row is loaded. So, I have a table that is being dynamically filled via ajax,ie: <body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/dojo/1.5/dojo/dojo.xd.js" djConfig="parseOnLoad: true, isDebug:true"></script> <div id="table-pane" dojoType="dijit.layout.ContentPane"> <table class="test"> <tbody> <tr><td>Name</td><td>Year</td><td>Age</td></tr> <tr> <td><span dojoType="dijit.InlineEditBox" editor="dijit.form.Textarea">Mike</span> </td> <td>2010</td> <td>12</td> </tr> </tbody> </table> </div> </body> <script> var html ='<tr><td><span dojoType="dijit.InlineEditBox" editor="dijit.form.Textarea">John</span></td><td>2011</td><td>22</td></tr>'; dojo.require("dijit.layout.ContentPane"); dojo.require("dijit.InlineEditBox"); dojo.require("dijit.form.Textarea"); dojo.addOnLoad(function(){ pane = dijit.byId("table-pane"); add_elem(); }); function add_elem(){ var node = $(".test tr:last"); node.after(html); dojo.addOnLoad(function(){ //Here I want to initiate any widgets that haven't been initiated pane.buildRendering(); }); }</script> How do I render the Dojo widget in the new table row?

    Read the article

  • How atomic *should* I make an Ajax form?

    - by b. e. hollenbeck
    I have some web forms that I'm bringing over with AJAX, and as I was dealing with the database on the back end, I thought that it might be easier to just handle each input on the form atomically with AJAX, saving the form in 'real time' as the user edits it. The forms are ~20 fields of administrative settings. Would this create massive overhead with the app, cause it to be error-prone, or is this a feasible idea? Of course, contingent operations (like a checkbox that then requires a text entry) would be held until the textbox gained and lost focus. Comments?

    Read the article

  • displaying the values in textbox based on AJAX fetched entries

    - by Anurag
    hello, I've a table in which addition rows can be generatred as per the user need by clicking a javascript function. Each row has a drop down list, and based on the values of this an AJAX script fetchs some values which has to be displayed in corresponding textfields of the same row.. here is the code for HTML.. <td><div align="center"> <label> <select name="gcno1" id="gcno1" onchange="fetch_gc(this)"> <option value="0">NIL</option> <option value="2">1</option> <?php while($row=mysql_fetch_array($result)) { ?> <option value="<?php echo $row[0]; ?>"><?php echo $row[0]; ?></option> <?php }?> </select> </label> </div></td> <td><div align="center"><input name="date1" id="date1" type="text" size="10" /> </div></td> and here is the AJAX which I'm writing... xmlhttp = new XMLHttpRequest(); var value=encodeURIComponent(document.getElementById('gcno1').value); var parameters="param1="+value; xmlhttp.open("POST", 'fetch_gc.php', true); xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); xmlhttp.send(parameters); xmlhttp.onreadystatechange=function(){ if(xmlhttp.readyState == 4 && xmlhttp.status == 200) { var detail=xmlhttp.responseText.split('+'); alert(detail[0]); document.getElementsByName('date1').value=String(detail[0]); alert("life " + document.getElementById('gcno1').value); } } The alert inside the AJAX shows the correct response text, detail[0] but is unable to put the value in corresponding textbox i.e. with name 'gcno1'...... Please help me with this problem...

    Read the article

  • Symfony : ajax call cause server to queue next queries

    - by Remiz
    Hello, I've a problem with my application when an ajax call on the server takes too much time : it queue all the others queries from the user until it's done server side (I realized that canceling the call client side has no effect and the user still have to wait). Here is my test case : <script type="text/javascript" src="jquery-1.4.1.min.js"></script> <a href="another-page.php">Go to another page on the same server</a> <script type="text/javascript"> url = 'http://localserver/some-very-long-complex-query'; $.get(url); </script> So when the get is fired and then after I click on the link, the server finish serving the first call before bringing me to the other page. My problem is that I want to avoid this behavior. I'm on a LAMP server and I'm looking in a way to inform the server that the user aborted the query with function like connection_aborted(), do you think that's the way to go ? Also, I know that the longest part of this PHP script is a MySQL query, so even if I know that connection_aborted() can detect that the user cancel the call, I still need to check this during the MySQL query... I'm not really sure that PHP can handle this kind of "event". So if you have any better idea, I can't wait to hear it. Thank you. Update : After further investigation, I found that the problem happen only with the Symfony framework (that I omitted to precise, my bad). It seems that an Ajax call lock any other future call. It maybe related to the controller or the routing system, I'm looking into it. Also for those interested by the problem here is my new test case : -new project with Symfony 1.4.3, default configuration, I just created an app and a default module. -jquery 1.4 for the ajax query. Here is my actions.class.php (in my unique module) : class defaultActions extends sfActions { public function executeIndex(sfWebRequest $request) { //Do nothing } public function executeNewpage() { //Do also nothing } public function executeWaitingaction(){ // Wait sleep(30); return false; } } Here is my indexSuccess.php template file : <script type="text/javascript" src="jquery-1.4.1.min.js"></script> <a href="<?php echo url_for('default/newpage');?>">Go to another symfony action</a> <script type="text/javascript"> url = '<?php echo url_for('default/waitingaction');?>'; $.get(url); </script> For the new page template, it's not very relevant... But with this, I'm able to reproduce the lock problem I've on my real application. Is somebody else having the same issue ? Thanks.

    Read the article

  • Returned JSON is seemingly mixed up when using jQuery Ajax

    - by Niall Paterson
    I've a php script that has the following line: echo json_encode(array('success'=>'true','userid'=>$userid, 'data' => $array)); It returns the following: { "success": "true", "userid": "1", "data": [ { "id": "1", "name": "Trigger", "image": "", "subtitle": "", "description": "", "range1": null, "range2": null, "range3": null }, { "id": "2", "name": "DWS", "image": "", "subtitle": "", "description": "", "range1": null, "range2": null, "range3": null } ] } But when I call a jQuery ajax as below: $.ajax({ type: 'POST', url: 'url', crossDomain: true, data: {name: name}, success: function(success, userid, data) { if (success = true) { document.write(userid); document.write(success); } } }); The userid is 'success'. The actual success one works, its true. Is this malformed data being returned? Or is it simply my code? Thanks in advance, Niall

    Read the article

  • Can't seem to get Prototype AJAX form validation to work in conjunction with Codeigniter

    - by MattB
    Is there some kind of trick involved? Here's how I would envision it working: 1) User tries submitting the form 2) Event.observe captures this and sends an AJAX request to a special validation URL (PHP using Codeigniter) 3) If no errors were returned, continue submitting the original form 4) If errors were found, cancel form submission and display Mostly, I can't seem to get a separate AJAX validation request to work as the form continues submitting. I could use Event.stop(event), but have not found a way to re-start the process if no validation errors exist from the validation call. I'd post code, but I have about 15 examples of things I've tried and it would just clutter this question. Any ideas? :-( I didn't think form validation would be this difficult. Many thanks, - Matt

    Read the article

  • Display Ajax Loader while page rendering

    - by Dean
    This is probably a simple question but how can I best use an AJAX loader in ASP.NET to provide a loading dialog whilst the page is being built? I currently have an UpdatePanel with an associated UpdateProgressPanel which contains the loading message and gif in a ProgressTemplate. Currently I have a page that onLoad() goes and gets the business entities and then displays them. While it is doing this I would like to display an AJAX loader. Would it be better to have nothing in the page load and have a hidden button that is triggered onLoadComplete or unLoad() which would then wait for the button click method to complete displaying the UpdateProgressPanel?

    Read the article

  • AJAX CascadingDropdown - Setting the selected index

    - by RPM1984
    I have a CascadingDropDown on an ASP.NET page. Now, the prompt text is "Select State". (list of states). However, on a different version of this page (ie querystring), i might want to set the selected index to "California" for example. How can i do this? The web service used by the ajax control (ie GetStates) gets invoked at the same time the jquery document.ready function is triggered (ie asynchronously). So when i try and set the selected index in jquery, the items are not yet bound. Is there a way to attach a handler to the ajax dropdown so that i can set the selected index once the webservice call has completed, and the items are bound?

    Read the article

< Previous Page | 28 29 30 31 32 33 34 35 36 37 38 39  | Next Page >