2018-10-22         Josephine

javascript delay output

I have written some code to display server's current date and time on browser every time user clicks the button . I have done this using ajax in django with the help of jquery. Now my, problem is I have to continously display the date and time once the button is clicked .Some Sample code or utilities allowing such kind of delay will be helpful . Thanks in advanceThe template is : $(document).ready(function() { $("button").click(function() { $.ajax({ type: "POST", url :"/showdate/", ...

 ajax                     2 answers                     16 view
 2018-10-22         Truda

Using AJAX in django

I am new to AJAX and django.I have written my own XMLHttpRequest call on browser side. I will have to manually set the header request.META['HTTP_X_REQUESTED_WITH'] to string XMLHttpRequest.How can I access these headers on browser side? Use HttpRequest.is_ajax(). See the docs. [XXX]Some post about django and ajax: Django AJAX Tutorial Part 1 - adding email to newsletter [XXX]If you want an easy to use solution for impolementing ajax ni django, I would recommend dajax i am using it in my own project and it simplifies things a lot.of cause you wont be able to custom...

 ajax                     3 answers                     16 view
 2018-10-22         Leonard

django: ajax view structure

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 hereand 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 advic...

 ajax                     2 answers                     15 view
 2018-10-22         Yves

Laravel ajax store request errormessage, data append to view

I'm new to ajax and I have two little problems. With my code I can write the data in the database. I get no error messages and the data are not synonymous directly loaded into the view.how can I load the data directly into the view without reload the page? if the privacy is 1, the code should be displayed in the right column, and if the privacy is 0, the code should be displayed in the left column.How can I output the error messages with my errormessage code?view<div id="content" class="dashboard padding-10"> <div class="row"> <div class="col-md-off...

 ajax                     1 answers                     91 view
 2018-10-22         Griselda

Ajax.Request apparently not evaluating JS code

I am creating a report, both the interface for the report parameters and the report itself is created by the exact same php file.This are the first lines of the part of the file called when the report is being created: <script type="text/javascript">alert("bla");</script>Whenever I use this code to pull the reportnew Ajax.Updater('reportarea','reportengines/<?=$configdata['filename']?>', { method: 'post', parameters: { action: 'executereport', ...

 ajax                     1 answers                     21 view
 2018-10-22         Nathaniel

Why is Xpath printed instead of the text inside the element?

I'm trying to scrape match statistics of a game of football yesterday at the following url:https://www.flashscore.com/match/8S0QVm38/#match-statistics;0I've written code, just for Webdriver to select the stats I want and print them for me so I can then see what I want to use. My code is:from selenium import webdriverfrom selenium.webdriver.common.by import Byfrom selenium.webdriver.support.ui import WebDriverWaitfrom selenium.webdriver.support import expected_conditions as ECbrowser = webdriver.Firefox()browser.get("https://www.flashscore.com/match/8S0QVm38/#match-statistic...

 ajax                     2 answers                     11 view
 2018-10-22         Arlene

Error 0 while making ajax request to WebApi

I am making ajax request to my WebApi and I get the error 0 in callback once page load whereas I am geeting correct json when the url hit the WebApi.When I inspected the page in chrome's consol tab shows that the url changed. I am requesting for http://localhost:1960/api/Product/GetProducts in my code and in chrome it changes to http://localhost:1960/api/Product/GetProducts?_=1534696122451. Please suggest what should need to done.codevar dataTable = $('#productTable').DataTable({ "ajax": { "url": 'http://localhost:1960/api/Product/GetProducts', ...

 ajax                     1 answers                     83 view
 2018-10-22         Kay

How to declare a LOOKUP CHANNEL for django user model in django ajax-selects

I am using django-postman to provide user-to-user message facility and this uses django ajax-selects to provide autocomplete facility for usernames when sending a message. I need to declare a channel for Django user and pass it to the postman application. Here how it has to be done. I declare a channel as shown below and AJAX_LOOKUP_CHANNELS = { # pass a dict with the model and the field to search against 'user' : {'model':'django.contrib.auth.User', 'search_field':'username'},}here I pass it to the postman appPOSTMAN_AUTOCOMPLETER_APP = { 'name': 'ajax_sele...

 ajax                     1 answers                     93 view
 2018-10-22         Saxon

Dynamically created DOM elements on ajax success method

i have a little error with my ajax success method DOM elements creation. on the success method i have created an html table row and inside that row i have created a form but this form not work ass expected.this is a code on ajax successsuccess: function(data) { html=''; for (i = 0; i < data['qoutations'].length; i++) { html+='<tr><form method="post" action="index.php?route=catalog/product/getForm&user_token={{ user_token }}">'; html+='<td class="text-center"><input type="checkbox" name="selected[]" value="'+...

 ajax                     1 answers                     72 view
 2018-10-22         Rita

How to get last id number in console.log?

When I click submit I get this message. ReferenceError: input is not definedHow to get last id number in console.log when I create a new data and click on save or submit button?Controllerpublic function store(Request $request){ if($request->ajax()) { $school = new SchoolsList(); $school->user_id = auth()->user()->id; $school->province_id = $request->province_id; $school->city_id = $request->city_id; $school->center_id = $request->center_id; $school->save(); return response()->json(['dat...

 ajax                     1 answers                     61 view
 2018-10-22         Beryl

How to Ajax with select2 auto fill another input field

please your help ,how to auto fill with ajax + select2 using medoo framework database to autofill another input in same form .this my ajax code :$('.matrix').select2({ ajax: { url: "index.php", dataType: 'json', data: function (params,page) { return { q: params.term, // search term qa: 'matrix' }; }, processResults: function (data,params) { return { results: $.map(data, function(obj) { return { id: obj.id, text: obj.text }; })...

 ajax                     1 answers                     17 view
 2018-10-22         Archibald

Creating database entries in Exist-DB with Ajax calls

While developing a self-contained exist-db app I ran into some issues with passing on the user's identity during an ajax call.I have created a standard page that allows the user to login in with his or her standard exist-db account. (It's more or less based on this https://github.com/eXist-db/existdb-login ). At some point, the users need to create their own entries and upload files, and this is done with an ajax script (I'm using Kartik's bootstrap uploader, but it's basically a standard ajax upload function):$('#input-24').fileinput({ uploadUrl: "../modules/uploade...

 ajax                     3 answers                     28 view
 2018-10-22         Edith

How can I post my Object via Ajax and store int into the database via Entity Manager?

$('#form_save').on( 'click', function (e) { e.preventDefault(); var form = $(this).closest('form'); var formData = form.serializeArray(); alert(formData.toSource()); $.ajax({ method:'POST', url:'{{ path('edit_form', { 'slug': page.slug }) }}', data: formData, success: function(data){ alert("success"); } }); });var formData is giving me the following alert output:[{name:"form[username]", value:"1"}, {name:"form[email]", value:"1@12.sw"}, {name:"form[is_active]", value:"1"}, {name:"form[plainPassword...

 ajax                     2 answers                     63 view
 2018-10-22         Baron

Paginate Widget breaks layout when loaded using ajax in Typo3

There is an issue I am facing in using pagination widget with ajax. What I am doing is, that I select category and then hit an ajax request to fetch the corresponding list by loading the data in the template and returning the html like this:<f:if condition="{articles}"><f:then> <f:widget.paginate objects="{articles}" as="paginatedArticles" configuration="{itemsPerPage: numberOfRecords}"> <f:for each="{paginatedArticles}" as="article"> <h2> <f:link.action action="show" arguments="{article : article}"> {a...

 ajax                     1 answers                     65 view
 2018-10-22         Kirk

document.fonts.ready.then why considered Synchronous XMLHttpRequest

When declaring font-face : browsers tends to wait to have text WITH this font to load the .ttf or .otf ...I discovered this codedocument.fonts.ready.then(function () { });When I try function myAajax () { var xhr = new XMLHttpRequest(); xhr.open("POST", "ajax.php", true); ... xhr.send(params);}document.fonts.ready.then(function () { myAajax (); });I get [Deprecation] Synchronous XMLHttpRequest... in chrome console log...Will this eventually blocked ? The workaround I found is to make a div with display hidden<div id="ajaxContent" style="display:none;">&...

 ajax                     1 answers                     49 view
 2018-10-22         Kent

Grails - How to submit a list of localDates to a command object using ajax?

You have a command object that accepts something likeclass myCommand {List<LocalDate> someDates...And you are posting to the controller using ajax.What is the correct format to submit? Any type of date-formatted string does not seem to work. Believe it or not you can url encode an array. Butr you should only do this if you are sending as GET. Hence, that would be a 'batch' GET Request.This can be done using commas (which are 'reserved' characters) like so:http://localhost/yourapi?id=1,2,3,4,567,899,213Then all you have to do is parse into a List if you detect as a ...

 ajax                     1 answers                     11 view

Page 1 of 170  |  Show More Pages:  Top Prev Next Last