w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
How could I send the information in AJAX at POST?
Change "GET" to "POST" and put the data (in the same form as in the query string, but without the ? prefix) as the argument to the send() method instead of in the URL.

Categories : PHP

Securely pass information to PHP via AJAX?
You could generate a special hash for each world key and use that. Another option is to a hash of all the other values and validate against that. There is no guarantee that it still couldn't be hacked.

Categories : PHP

Ajax pulling information from second select and database
I think you need to concat the values of the dropdownlist. Something like: <script type="text/javascript"> function server(aform) { var xmlhttp; if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { document.getElementById("txtHint").innerHTML=xmlhttp.responseText; } } xmlhttp.open("GET","getuser.php?q="+ product.value +"&" +"p="+product_i.value ,true); xmlhttp.send(); } </script>

Categories : PHP

Toggle information pulled from MySQL with jQuery Ajax
You have to somehow save state. You can do something like: $("body").on("click", ".plist", function(e) { $this = $(this); if( $this.data('visible') ){ $this.data('visible',false) $this.hide(); success:function(response){ $("#loaderDiv-"+pID).data('visible',true) .... }

Categories : Javascript

Keeping the information obtained in a $.ajax call's done(...) method
Yes, you are right you are assigning to a global variable in your .done, There's nothing wrong in that, the problem is that you are trying to use that global variable before your ajax call is completed (i.e before your .done is executed). That is because of asynchronous behavior or ajax. One bad way to make it work is to make your ajax call synchronous with async:false

Categories : Javascript

Change & save SPAN CSS on AJAX SUCCESS then retrieve saved information
This adds classes to the plus and rateCount spans similarly to the way the clicked class is added to the up span. <?php $ip = $_SERVER['REMOTE_ADDR']; $sth = $db->prepare("SELECT add_iP FROM PostsRating WHERE post_iD_fk = :post_iD AND add_iP = :ip"); $sth->execute(array(':post_iD' => $post_iD, ':ip' => $ip)); $clicked = $pluswhite = $ratewhite = ''; if ($sth->fetchColumn()) { $clicked = " clicked"; $pluswhite = " PlusWhiteButton"; $ratewhite = " RateCountWhiteButton"; ?> <span class="up vote<?php echo $clicked;?>" name="voteUp" id="<?php echo $post_iD;?>"> <span class="plus<?php echo $pluswhite;?>">+</a> <span class="rateCount<?php echo $ratewhite;?>"><?php echo $VoteRat

Categories : PHP

Invoking a modal dialog to collect some information in JQuery ajax beforeSend
Due to the asynchronous event model in javascript, you cannot postpone the ajax request from being sent off from within beforeSend. Once beforeSend is executed, the only chance you have to "delay" the ajax request is to outright cancel it entirely by returning false from the callback. So while you could keep track of a status variable that knows whether the form is ready to submit (return false from beforeSend whenever the form is not ready), you're much better off doing these validation checks before ever creating the ajax request to begin with. // why do this $.ajax('/path', { beforeSend: function () { if (formIsNotReady()) { showModal(); return false; } } }); // when you can do this if (formIsNotReady()) { showModal(); } else {

Categories : Javascript

VBA to Copy Information From a Folder of Files and Compile Information to a Single Workbook
This is not the full code, but it should help you. When you work with multiple workbooks keep track of them. For example start with: Dim CurrWB As Workbook Set CurrWB = ActiveWorkbook Then in the cycle: Dim WB As Workbook For Each StrFile In var Set WB = Workbooks.Open(loc & StrFile) ... WB.Close Next StrFile Inside the cycle you can find the area to copy doing something like: R1 = 1 Do While WB.Sheets("Sheet name").Cells(R, 2) <> "Starting text" R1 = R1 + 1 Loop R2 = R1 + 1 Do While WB.Sheets("Sheet name").Cells(R2, 2) <> "Ending text" R = R + 1 Loop For R = R1 to R2 CurrWB.Sheets("Report").Cells(RReport, 3) = WB.Sheets("Report").Cells(R, 3) RReport = RReport + 1 Next R

Categories : Excel

Reply mail structure information: how to retrieve sent and received information
There's no standard for the structure of a reply email. It's not usually done using multipart email, it just uses human-readable text, often with > prefixes to denote quoted text. This allows replies to be interspersed inline with the quoted material. The only standard features of replies are a couple of headers: In-Reply-To: <ID> and References: <ID1>, <ID2>, <ID3>, ... In-Reply-To contains the message ID of the message that was replied to. References is a growing list of message IDs -- when you reply, you take the original message's reference list and append the ID of the message being replied to at the end. See RFC 5322 for more details about these headers.

Categories : PHP

how to get the information of about database events and actor information
Look at the MODULE, ACTION and CLIENT_INFO columns of V$SESSION. Then, in the package(s) and/or trigger(s) you suspect are performing the update, call DBMS_APPLICATION_INFO.SET_MODULE and DBMS_APPLICATION_INFO.SET_ACTION: BEGIN DBMS_APPLICATION_INFO.SET_MODULE(trigger_name, 'trigger start'); -- some code... DBMS_APPLICATION_INFO.SET_ACTION('updating employee'); -- code which updates the employee table DBMS_APPLICATION_INFO.SET_ACTION('doing something else'); -- more code... DBMS_APPLICATION_INFO.SET_MODULE(NULL, NULL); END; See also the example provided in the usage notes.

Categories : Oracle

Jquery bind on 'ajax:success', 'ajax:error' or 'ajax:complete' not executed even though form is submitted
In Jquery, Ajax Event has two types. One is local event, another is global event. Local Event, It will be defined with ajax request: $.ajax('YOUR PATH', {success: function(){ alert(!) }}); Global Event, It should be binded with document element: $(document).bind('ajaxSuccess', function() { alert('!'); }); see fiddle and jquery api

Categories : Jquery

jQuery Ajax:- How to remove pending ajax call and active recent ajax call?
You can do like this. var CurrentAjaxReq = null; if(CurrentAjaxReq != null) { CurrentAjaxReq.abort(); } CurrentAjaxReq = jQuery.ajax({url: '/xyz.php', success: function(data) { CurrentAjaxReq = null; //do something } });

Categories : Ajax

jQuery: Can I send and receive an $.ajax response while a longer $.ajax request is pending?
Instead of doing an ajax post you can post to an iframe and have php generate incremental output and send it with the flush command. // send a hash mark for every 1000 inserts $a = 0; while ($rec = getDataForNextInsert()){ $a++; // do insert if ($a%1000 == 0) { echo '#'; flush(); } } It would also then be possible to poll the contents of the iframe to provide a pretty display for the end user.

Categories : PHP

Show ajax spinner, hide page render until ALL ajax calls complete?
One approach would be to display your loading animation as part of your initial page & page load. Then, wait for your outstanding ajax calls to reach zero and once that happens, hide the loading animation. Your document ready would look something like: $(document).ready(function() { $('#spinner').addClass('spin'); function stopSpinner() { $('#loading').addClass('hide'); $('#loading').one('webkitTransitionEnd', function() { $('#loading').hide(); }); } $(document).ajaxStop(function () { // $.active == 0 stopSpinner(); }); }); Your markup would have something like this as the last elements in the body: <div id="loading"> <div id="spinner"></div> </div> With styles like this: #lo

Categories : Ajax

Laravel: strange behavior when I try to serve ajax and non-ajax request on same route (Caching)
Definitely a caching issue. Just to try and get some results, add this to your controller (ajax and non-ajax) to force-disable caching: header("Cache-Control: no-cache, must-revalidate"); // HTTP/1.1 header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past And see if chrome still fetches from the cache on the back button.

Categories : Laravel

Jquery AJAX Global Timeout (Entire Application) Im using $.get & $.post (can't use $.ajax)
You can attach an ajaxError handler to document $(function(){ $(document).ajaxError(function(event, request, settings) { //Do whatever }); }); Edit: To set Ajax timeout globally, you have to use ajaxSetup $.ajaxSetup({ timeout: 2000 //Time in milliseconds }); Note:$.ajaxSetup should be set before other Ajax calls.

Categories : Jquery

Diffence between usage of Ajax Update Panel and Jquery:ajax() method
An update panel performs a full re-render of the page, takes the section matching the panel and sends it back to the client. The browser then replaces the contents of the update panel with the new html. jQuery's AJAX method allows you to make any request to any page and handle the response data any way you choose. This might include reading a JSON response from a web service, getting html or anything else you wish. Effectively AJAX gives you a mechanism to emulate the user browsing to a given url with GET or POST data and manipulate the results in any way you desire. It's worth noting that the update panel is built on top of AJAX (technically Javascript's XMLHttpRequest) object. There are also some gotchas with update panel, eg if you have a Captcha that is outside the panel; When the

Categories : Asp Net

Checking username on local server using jquery, ajax and php ajax() not connecting
I always like to use GET request on AJAX issues, meaning to do jQuery AJAX with type:"GET" and read the parameter with GET on PHP.. So I can easily test the PHP page itself by running it in the browser like this localhost/ajax_check_username.php?username=something

Categories : PHP

$.ajax textstatus shows success but database is not updated?Jquery php ajax
I think you have an error in your SQL syntax, you should remove te "," before VALUES. If that doesn't work check MySQL errors with mysql_query("QUERY") or die(myql_error());

Categories : PHP

jQuery.ajax reloads page instead of performing ajax request in Safari on iOS
All that is needed to make this work is a return false; from the handler function. See event.preventDefault() vs. return false for a more complete explanation, but basically "return false from within a jQuery event handler is effectively the same as calling both e.preventDefault and e.stopPropagation on the passed jQuery.Event object." So a fully functional version of the above code is: getInfo = function() { $.ajax({ url: '/test/info', dataType: 'html', success: function(data, textStatus) { if ( textStatus == 'success' ) { // doing stuff with data } } }); return false; }; // The order of vv that string may be important $(document).on('click touchend', '.getInfo', getInfo );

Categories : IOS

Rails - RSpec/Capybara and AJAX: How to test an AJAX database update?
You're going to need to use a Capybara driver that can run Javascript, like PhantomJS. The standard Capybara driver doesn't run Javascript, and thus wouldn't invoke click handlers or AJAX.

Categories : Ruby On Rails

only one ajax call from javascript loop instead of looping multiple ajax calls
JS-Call: $.post('update_page_positions.php', {'myArray': m}, function(data, statusText) { // This block is optional, fires when the ajax call is complete } ); AJAX-Handler: <?php include("connect.php"); $myArray = json_decode($_POST['myArray']); // do stuff with $myArray here. ?>

Categories : PHP

nonce token after ajax response and hash problems using ajax jquery type json
To change hash function, if only '+' is the problem you may keep a check while creating the string, next_char = Randomly-created-char; if(next_char == '+'){ //do nothing } else{ hash .= next_char; } Here is how the html and php files should be like. The ajax call is shown in the .html file. .php that loads your form for the first time. <!DOCTYPE html> <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script> <script type="text/javascript"> $(document).ready(function(){ $("#check").click(function(){ $("#keyvalue").text($("#key").val()); }); $("#submit").click(function(){ var text = $("#text").val(); var key = $("#key").val(); $.ajax({ url: 'trial.php',

Categories : PHP

Need to put an ajax confirmation box instead of page for delete in zend framework using ajax
Lets assume that your index action displays a list of something that you want deleted. The way you do deleting via ajax is quite simple. Write a delete action, that returns the deletion status Call it via ajax, and do the appropriate response. Now how this would all look like: index.phtml This view should contain something like the following code for jQuery: $("#button").click(function(){ var menuId = $("ul.nav").first().attr("id"); var request = $.ajax({ url: "/index/delete", type: "POST", data: {id : menuId}, dataType: "html" }); request.done(function(msg) { $("#log").html( msg ); }); request.fail(function(jqXHR, textStatus) { alert( "Request failed: " + textStatus ); }); }); IndexController:deleteAction() pu

Categories : Ajax

Unable to retrieve value in AJAX POST call. [Used AJAX, MVC ASP.net, .net framework 4.0]
you need to spe4cify the content type as JSON $.ajax({ type: "POST", url: $("#urlprefix").val() + 'AssetManagement/SaveNew', data: JSON.stringify({ del: del }), contentType: 'application/json', success: function (d) { console.log('here'); return false; }, error: function (msg) { } });

Categories : C#

how to prevent to send ajax request while another ajax reqeust is processing?
The better way is to simply not send a request until the user stops typing. this is easily done using the keydown event and a throttle waiting for 250ms of inactivity. Doing it your way will result in not getting the results that the user wants. $("#search").on("keydown",function(){ var $this = $(this); clearTimeout($this.data("throttle")); $this.data("throttle",setTimeout(function(){ doSearch.call($this.get(0),$this.val()); // perform the ajax search },250)) }); Also, when inserting the new results, build the entire result list in a single variable then insert it all at once with .html(thehtml) after the loop.

Categories : Javascript

Codeigniter ajax send data to controller using ajax code
var id = $("#select-dept").val(); data:"id", //Here you are sending string as id should be data:id, //No double quotes surrounded

Categories : PHP

How to get a part of HTML webpage in a jQuery ajax Request? In other words how to filter the web page contents on an ajax call?
success:function(data) { var out = ""; $(data).find("your selectors").each(function(loop, item){ out += $(item).html(); }); data = out; alert(data); $("body").html(data); }

Categories : Javascript

how to change type ajax call to controller of option "serviceUrl" in ajax autocomplete jquery devbridge with CodeIgniter?
I fixed my problems, but data that contains values for callback function when data is selected always null. What's up? MY SCRIPT: var options, a; $(document).ready(function(){ options = { serviceUrl:'controller_name/function_test', onSelect: function(suggestion) { alert('You selected ' + suggestion.value + ', ' + suggestion.data); } }; a = $('#search_by_user').autocomplete(options); }); MY FUNCTION IN CONTROLLER : public function function_test() { $query = isset($_GET['query']) ? $_GET['query'] : FALSE; //$query = 'te'; if($query) { $found = $this->model_name->get_list($query); $suggestions = array(); $data = array(); foreach($found as $row) {

Categories : Codeigniter

Ajax with PHP - Is Ajax a replacement of server side "View" of MVC?
You've asked two questions but I'm just going to answer the first one: can AJAX replace the role a server-side view traditionally had? In MVC web frameworks the view is a template for converting data passed in from the controller into HTML, however, client-side templating languages have become quite popular and are a perfectly reasonable alternative to rendering HTML output on the server, and they have definite advantages. Firstly, since you're not sending an entire HTML payload to the client browser but instead just the content, you can save significantly on bandwidth. Generating the HTML client side allows you to transmit only data (like JSON or XML) to the client. The server side view would simply contain script tags pointing to the JavaScript templates and the content payload. Secon

Categories : PHP

Django / Closure: How to validate AJAX form via AJAX?
I got it to work. The basic trick was, if the form submission was successful, instead of returning a redirect I returned a basic response object with a redirect status code and the URL to redirect to. Then I modified my displayForm() to look for that and redirect if it was found. Here's the modified code from the Score() function: if form.is_valid(): form.save() messages.success(request, 'Score saved!') redirect = shortcuts.redirect('index') return http.HttpResponse(content=redirect['Location'], status=redirect.status_code) And the modified displayForm(): var displayForm = function(e) { var responseText = e.target.getResponseText(); if (e.target.getStatus() == 302) { // If this was a redirect form submission, the response text will be the

Categories : Ajax

jquery ajax loading gif while waiting for ajax response
If you set async: false, you're telling the browser to synchronize to that function's call responding, meaning it is going to wait. Remove or set to true and it will run asynchronously, e.g., will not freeze the browser waiting for it to finish.

Categories : Javascript

How to load a form using ajax, validate it then submit it using ajax?
you need to check the value of the plugin method valid so you need this if ($form.valid()) { // do stuff } not this if ($form.valid) { // always true, as presence of the plugin method is 'truthy' }

Categories : Jquery

AJAX. PHP. CURL. Ajax request to site, with another encoding
You use directly in browser wordstat/ajax?page=page&url=url but ajax use wordstat/ajax?query='+query+'&page='+page+'&id='+id Perhaps different arguments give you different results.

Categories : PHP

ajax show loading image when ajax is in process
function getProdList(id,langid) { var xmlHttp=initXMLHTTPRequest(); //console.log(xmlHttp); var str = "value="+id+"&langid="+langid; var span=""; var url = "../php/searchDetails.php?"; document.getElementById('imgDiv').style.display = 'block'; xmlHttp.onreadystatechange=function() { if(xmlHttp.readyState==4 ) { document.getElementById('imgDiv').style.display = 'none'; span=span+"<ul style='padding-bottom:20px;'><li><b>"+id+"</b></li>"; var xmldata=xmlHttp.responseXML; var xmlObj = xmldata.getElementsByTagName("ProductDetails")[0]; var menusize=xmlObj.childNodes[0].childNodes[0].childNodes[0].nodeValue; var xmlObjlength = xmlObj.childNodes.length; for(var i=1;i<xmlObjlength;i++) { var ProductName=xmlO

Categories : PHP

Use a Function That Returns Ajax to Ajax.BeginForm's onBegin
What you are trying to accomplish without it being synchronous just is not going to happen. You WILL have to perform a synchronous check. Otherwise the check will be called but the form and other things will be submitted before the ajax call has time to say "Wait for me." In your ajax call to the server you have to set async: false on a $.ajax call. This will make it to where it will expect some sort of result before running the next bit of code. Keep in mind that you wouldn't want to do $.get because there is no option to turn it off. If you "don't want the UI to hang".... Put some sort of loading icon or text. It's a good practice for "ajax" stuff anyways... Here is the code you could use :) function checkIfMyConditionExists () { $.ajax({ url: checkConditionURL, a

Categories : Asp Net Mvc

How to send a Javascript/Ajax variable to a php page using AJAX
if you want to pass the ip as a GET value you have to add the GET key function runGetIperfSpeedAjax(speedVar, actualIp) { var xmlhttp = getAjaxObject(); xmlhttp.onreadystatechange = function () { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { processIperfRequest(xmlhttp.responseText, speedVar); } } xmlhttp.open('GET', 'lib/getIperfSpeed.php?ip='+actualIp, true); // missing in your code '&ip='+actualIp xmlhttp.setRequestHeader('Content-type', 'application/x-www-form-urlencoded'); xmlhttp.send(); } function processIperfRequest(response, speedVar) { alert("proccess"); document.getElementById(speedVar).style.display = 'none'; document.getElementById('displaySpeedTest').style.display = 'block'; docume

Categories : PHP

In Ajax Response getting whole page : Spring MVC, Ajax
The HTTP 406 is probably caused by not having the jackson-core-asl and jackson-mapper-asl jars on the classpath. See here and the Stack Overflow post here. To summarise, if you're using Maven, you would add the following two dependencies to your pom.xml <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-core-lgpl</artifactId> <version>1.9.12</version> </dependency> <dependency> <groupId>org.codehaus.jackson</groupId> <artifactId>jackson-mapper-lgpl</artifactId> <version>1.9.12</version> </dependency> If not using Maven, just ensure that the two jars above are present on the classpath.

Categories : Ajax

Sending an AJAX call before all other AJAX calls
UPDATED: Have one method on an interval that sets up the 'session'/local-storage var refreshing = false; var intervalID; $(document).ready(function(e){ var delay = 1234; intervalID = window.setInterval(setupInterval, delay); }); function setupInterval(){ refreshing = true; $.ajax(URL).done(function(r) { //do stuff setupStorage(r); refreshing = false; }); } function setupStorage(info){ //setup whatever here } OLD: Could you use some logic in your ready function to gate what you need to do? So basically call one ajax call -> if false, just schedule your latter methods, otherwise run the setup one and on completion schedule the latter method. Some pseudo-code: var refresh = false; $(document).ready(function(e){ $.ajax(URL).done( function(r) { if(r) {

Categories : Javascript

Ajax overlay not showing during ajax request
I guess it's related to the synchronous AJAX call (cf. jQuery documentation about AJAX settings). I'd try modifying your code to be something like showOverlay(); var searchString = $("#search-results-form-query").val(); $.ajax({ url: "Order?Page=storeSearchKeyword", data: "searchString="+searchString, success: function (data, textStatus, jqXHR) { var manResult = jqXHR.responseText; $("#cart-product-list").empty(); $("#cart-product-list").append(manResult); hideOverlay(); } });

Categories : Javascript



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.