Questions tagged [ajax]

40706 questions
1

votes
3

answer
17.8k

Views

how to return data to ajax from java Servlet [duplicate]

This question already has an answer here: How to use Servlets and Ajax? 7 answers i have my ajax function as follows: $.ajax({ type: 'GET', url: "/myservlet", data: { objects: '2', dimension: '2', }, success: function( data ) { console.log(data); alert(data); }, error:function(data,status,er) { ale...
roland luo
1

votes
1

answer
1.6k

Views

JSON.stringify() - Escaping Issue

I am currently using AJAX with JQuery to send json to an API server. However, there seems to be an issue with a server that is escaping the JSON string when I use JSON.stringify() but on another server when using the exact same code it works without any problems. Here is an example of the Javascrip...
Daniel West
-1

votes
0

answer
31

Views

why does jquery ajax request only write one data field?

In this code here, i want to save two data objects in a DB, but it only writes one of them, as you can see in this screenshot from the Atlas web portal: Here is the code: $('form').on('submit', function(){ $('#taskMakerForm input').each(function() { $.ajax({ type: 'POST', url: '/calendar', data: thi...
griesgram
1

votes
2

answer
364

Views

retrieve data from database without refreshing the page

When the user press entre the data will be save into database. Ajax $('td.edit').keydown(function(event){ arr = $(this).attr('class').split( " " ); var clientid=document.getElementById("client").value; account_id=document.getElementById("account_id").value; if(event.which == 13) { $.ajax({ type:...
arok
1

votes
1

answer
96

Views

AJAX won't transfer variable to PHP

I am trying to transfer input from Javascript to PHP with AJAX but the input will not transfer. Here is my JS code: div{border:solid;} div{background-color:blue;} Comment: Submit Comment function getInput(){ var input = document.getElementById("comment").value; addComment(input); } function addC...
user2707299
1

votes
1

answer
2.2k

Views

Django QuerySet not serializable

I have the following function I'm using to make Ajax calls: 30 import json 31 32 def get_info(request): 33 run = Run.objects.values('nvp_build', 'lports', 'lswitch_stt') 34 measurements = Measurements.objects.values('maxfield') 35 apistats = APIStats.objects.values('num') 36 clusterdata...
cybertextron
1

votes
4

answer
25.9k

Views

how to insert value in database using php, jquery and ajax

I am struggling very hard to get this to work and I don't know what I'm doing wrong. I have a register page that I want to take the data inserted into the form and INSERT it to the database with jQuery and AJAX. I'm not very experienced with AJAX AND jQuery so be gentle! :P I will show you the...
mishraoft
1

votes
1

answer
394

Views

php to AJAX form submission

Newbie here in AJAX i got this code, Please help, my code keeps going to the sec_reg.php page even if the password is mismatch, or even when the form is valid, i want the user to stay on current page even if he submits a form. Here is my code Here is my form ADD ANOTHER ADMIN Email Password Confirm...
user3196424
1

votes
1

answer
426

Views

Windows Explorer incorrectly displays WebDAV server file/folder names

In "IT Hit WebDAV Server Engine" implementation I have IHierarchyItem.Name returning “My Folder”. But IHierarchyItem.Path returns /2347182436872364/971553455213456772/ for the same item. In Windows Explorer this folder is displayed as 971553455213456772 while in "IT Hit Ajax File Browser" it i...
Taras Kozubski
1

votes
1

answer
5.8k

Views

isotope reLayout with Ajax

I have almost 10 different AJAX call at document load. I've tried insert() and reLayout() functions of Isotope when AJAX is succeeded, but i couldn't get it work. I opened jsFiddle but AJAX not working because its not reachable from the outside. Although you can see the AJAX call and if you can tell...
Orion623
-3

votes
0

answer
19

Views

The server responded with a status of 405 (Method Not Allowed) Using GET Method

The server responded with a status of 405 (Method Not Allowed) Using the GET Method. Can you tell me where is the issue that I am facing? CODE SAMPLE $('.itemName').select2({ placeholder: 'Select an item', ajax: { type: "GET", url: '{{ route('autocomplete.fetch') }}', contentType: "application/json;...
gaurav Nectarbits
1

votes
2

answer
73

Views

jQuery Loop that slows your browser

I'm creating online chat, but I'm wondering while using jQuery .load() in my script, my browser seems to get slow. When i checked the inspect element "Net" section, it loads bunches of GET-data... etc. I would like to know if there's a better script solution with this code to prevent chat being heav...
iMarkDesigns
1

votes
5

answer
621

Views

jquery: how to wait until ajax call would be completed

I have an anchor on my page that leads to some other website. I want to keep track on clicking that anchor, so I wrote a little click handler. Leave and there's javascript code... $(".js-button").on("click", function() { var name = $(this).data("name"); $.when( $.ajax({ url : 'statscript.php', type...
Dmitry Samoylov
1

votes
3

answer
6.2k

Views

Passing Image using Ajax to PHP

I am trying to pass an image and a title field value to PHP, I usually process file uploads straight with PHP using the $_FILES array, I am not sure how to create/pass this array using ajax to PHP. My form: Update Product And I am trying to use this to pass to PHP: $('#updateProduct').on('click', fu...
Youssef
1

votes
1

answer
1k

Views

Ajax load from PHP/MySQL generated Bootstrap drop down with variable pass

I have two problems with my code, but because I am not quite sure that they are not related, I'll ask them together. Question one: My button group, static + dynamically generated (by a PHP while loop of a MySQL query) drop down loads on the first page load. However, after loading content with Ajax t...
1

votes
2

answer
4.3k

Views

How to use Flask's render_template from an ajax POST form submit

I am hoping to get an answer to this similar question: I have a jQuery form that sends JSON data to a certain URL that is served by Flask: jQuery(document).on('ready', function() { jQuery('form#send').bind('submit', function(event){ event.preventDefault(); var form = this; json = geojson.write(vecto...
camdenl
1

votes
0

answer
14

Views

dynamic ajax form select box autofill

I'm strugglin to make a PHP Form with Dynamic Fields with Auto Complete in JQuery, so far I can add new fields and the autocomplete works just fine but only for the first field. The autocomplete drop down only appears on the first input. How can I make all dynamic form input work with the autocompl...
Jije's Stackoverflow
1

votes
2

answer
942

Views

Refresh page with new query string …MVC

I have an MVC 3 project where you can edit a record, or clone it. When you click on the record to edit, the url looks like this: http://localhost/Products/Edit/?Id=123 If the user clicks clone, a popup window appears asking for a new name. The user enters a name then clicks proceed. An ajax call is...
BoundForGlory
1

votes
1

answer
603

Views

Not able to get serialized Array of Kendo UI Form

I have a simple form, where I have a form element with one input type and button. When I am click button, I am trying to get form data using var fData = $("#test").serializeArray(); However for some reason, I am not able to get any values of form. What could be the reason for this? JSFiddle Demo
Jåcob
1

votes
1

answer
657

Views

How can I reload just one div on click?

I use Django and Python. Okay, the context is : models.py : class Contacts(models.Model): lastname = models.CharField(max_length=150) firstname = models.CharField(max_length=150) views.py def home(request): contacts = Contacts.objects.all() return render(request, 'index.html', {'contacts':contacts,...
Raphael
1

votes
2

answer
65

Views

AJAX form script isn't executed

I want to use a form via AJAX, so I got this Code Snippet from another post on stackoverflow. It didn't work, so I added an alert to check, if the script is even executed. That doesn't seem to be the case and I'm wondering why. var request; $("#foo").submit(function(event){ alert("Hallu"); if (reque...
Simon Mathewson
1

votes
1

answer
613

Views

CodeIgniter AJAX, doesn't update/receive new data in database

I have a problem with updating database using AJAX and CodeIgniter. When someone posts AJAX form I retrieve data about user from database this way: class MY_Controller extends CI_Controller { public $memberData; public function __construct() { parent::__construct(); $this->memberData= $this->membe...
6DM
1

votes
1

answer
180

Views

Rails 4.2 - Link to create action with Javascript results in 302

I have a rails app in which I have a dynamic form. One of the fields have a "submit" button of it's own. It looks something like this: ---------------- | Normal field | ---------------- ------------------------- | "Value" | Submit | ------------------------- List of "Values" ---------------- |...
Anders
1

votes
1

answer
400

Views

ajax responseText contains php source code

I am trying to make a ajax call and validate a input html field. But, instead of getting simple echo message. I am getting complete source code in responseText. JavaScript function checkUsername() { document.getElementById("username").className = "thinking"; usernameRequest = createRequest(); if (us...
saikumarm
0

votes
0

answer
6

Views

AJAX query database again onSelect - Remove cache

I have select options which are populated from the database using AJAX (jQuery). It is loaded inside a Modal. It passes an ID and the query uses that ID to retrieve the results which fills the options. $('#statusSelect').on('change', function() { if($('#statusSelect option:selected').val()=="Reserve...
Abu Nooh
1

votes
1

answer
4.5k

Views

partial view refresh not working after ajax call on a button click

I have a partial view and and submitting form on a button click using ajax. After submitting I want to reload the partial view and show a success message. Ajax request is submitting correctly but I m unable to reload the partialview in the desired div with class divPartial. The partial view is loadi...
rumi
1

votes
2

answer
6k

Views

jQuery multiple file upload from scratch

I am trying to implement a multiple image uploader in jQuery using the new HTML5 multiple attribute. My code is the following: The JS code I am using is taken from a discussion here on SO, and is the following: $('input[name=userfiles]').change(function() { var names = []; for (var i = 0; i < $(this...
wiredmark
1

votes
2

answer
453

Views

The success Function in Ajax Doesn't work When using Json

i have a login form that shows in a dialog box in jquery i need to pass a variable from php to my jquery using Ajax & json method the problem is that the success function in ajax doesn't work and i always get the error function here's my both php and jquery code: Jquery: $(document).ready(function...
Aminac
0

votes
0

answer
49

Views

Logout once the Browser is Closed

Greeting, Kindly I'm trying to record user sign out time in mysql DB once he close the browser, I searched for it but the most articles talking about window.onbeforeunload JavaScript event, but doesn't work with all Browser, even it works with F5 button can't specify massage or action, appreciate y...
1

votes
1

answer
3.4k

Views

Send data from textbox with ajax to asp.net mvc 5 controller

I need some help. I write little app using ASP.NET MVC5 with JavaScript, jQuery, Ajax... and I can't send data from javascript to MVC Controller and change the model. ViewModel public class MyViewModel { //... public string SearchString { get; set; } public int? FirstInt { get; set; } public int? S...
chibis0v
1

votes
1

answer
644

Views

Unobtrusive Submitting Ajax Forms Twice

I have seen multiple issues similar to this saying that unobtrusive was referenced twice and removing one fixed the problem but I have checked and it appears to only be referenced once. When I remove the single reference my form submits once like it should, but I don't get to take advantage of the...
mgrenier
1

votes
1

answer
94

Views

JQuery AJAX script not saving

Newbie here, I am working with these two jquery scripts for the whole day now. When I fire the first script the second script won't work. The first script checks whether a certain product name is already existing in the database, while the second script is the function to save the data entries on th...
Kim Carlo
1

votes
1

answer
1.9k

Views

Handling cross domain preflight AJAX OPTIONS requests with Spring MVC 4

This is probably a simple answer, but I can't seem to get it to work. In a cross-domain, preflight AJAX request, the client first makes an OPTIONS request just get a set of headers back to figure out what the remote server accepts. Right now, for every Spring controller POST interface that I create...
Bal
1

votes
2

answer
1k

Views

Can I cache contents loaded by jQuery.getScript()

As per jQuery documentation (https://api.jquery.com/jquery.getscript/) use more flexible $.ajax() method, but it doesn't work for me described in here (jQuery cannot load plugin file using ajax before calling the plugin function, thus, gives kind of weird result) By default, $.getScript() sets the c...
1

votes
3

answer
155

Views

Is node.js event loop like an ajax call?

I am confused with node.js' advantages over other tech. I've been reading this article : http://www.toptal.com/nodejs/why-the-hell-would-i-use-node-js and this How to decide when to use Node.js? to familiarize myself with it and have left me confused. I am familiar with cpu intensive task like the c...
Francis Zabala
1

votes
1

answer
1.5k

Views

django: csrf_token for multiple forms and ajax requests on a single page

My website has a single page with 2 forms and 3 ajax-based POST calls. I have used csrf_token in one of the forms. Also, to be able to perform csrf-safe ajax calls, I am using the guidelines posted on the official documentation: https://docs.djangoproject.com/en/1.7/ref/contrib/csrf/ and this blog:...
The Wanderer
1

votes
2

answer
11.3k

Views

POST headers and body using Jquery AJAX

I have to send a POST to a broker API including headers and a body: Action POST https://demo-api.ig.com/gateway/deal/session Header Content-Type: application/json; charset=UTF-8 Accept: application/json; charset=UTF-8 X-IG-API-KEY: 5FA056D2706634F2B7C6FC66FE17517B Body { "identifier": "A1234...
Youss
1

votes
2

answer
791

Views

Show loading in browser while form submit

I am using AJAX to get some data and fill-up the form. Data is quite large so it takes some time to get from DB and fill up in fields, so while all doing this stuff i am showing loading icon. Now there is a submit button in a form, and we want - that form should not be submitted until that loading...
daniyalahmad
1

votes
1

answer
1.5k

Views

Identifying if a website has AJAX requests

I'm wondering if there is a easy way to identify a website uses Ajax requests. I went through the following article, http://www.zansule.com/2010/08/how-to-tell-if-a-site-is-using-ajax/ Excerpt from the article : "With the XHR console opened, run the suspected Ajax based operation and monitor the co...
user1345260
0

votes
0

answer
16

Views

Laravel - Validate quantity field on server side for product which have different quantities

I have a form that have a drop-down to select a product from different product listings, upon selection an AJAX request is send to fetch the quantity of that particular product and max attribute is set for quantity HTML element. This is a form repeater (not any plugin) which creates dynamic element...
Mohsin

View additional questions