w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
JSON Data returned from Ajax on Safari is converted into a javascript list
Your best solution would be to tell jQuery that the response is json so that you will always receive it as js object $.ajax({ type: 'POST', url: '/requestHandle', data: data, success: function(obj) { // do something }, error: function(data) { // do something else }, dataType: 'json' // reponse is json so it will always be pre-parsed });

Categories : Javascript

SQL Server 2008 Management Console: Automatically write results to a script and execute it
Are you wanting something like this? If you only want to print the script use osql and a script something like this DECLARE @schema VARCHAR(255) DECLARE @table VARCHAR(255) DECLARE PrintOutputCursor CURSOR LOCAL FAST_FORWARD FOR SELECT [TABLE_SCHEMA], [TABLE_NAME] FROM INFORMATION_SCHEMA.TABLES OPEN PrintOutputCursor FETCH NEXT FROM PrintOutputCursor INTO @schema, @table WHILE @@FETCH_STATUS = 0 BEGIN PRINT 'DROP TABLE ['+ @schema + '].[' + @table + '];' FETCH NEXT FROM PrintOutputCursor INTO @schema, @table END CLOSE PrintOutputCursor DEALLOCATE PrintOutputCursor If you want to execute the script using osql use this script (NOT RECOMMENDED) DECLARE @schema VARCHAR(255) DECLARE @table VARCHAR(255) DECLARE @exec VARCHAR(4000) DECLARE PrintOutputCursor CURSOR LOCAL FAS

Categories : Sql Server

Preventing AJAX-called PHP-Script to execute a function
You could simply, check within the PHP file, who or what is requesting the PHP file! // If the request came from AJAX then do this if ($_SERVER["HTTP_X_REQUESTED_WITH"] == "XMLHttpRequest") { // Perform Ajax related stuff } else { // Perform non-Ajax related stuff } Though, take in mind that headers can always be faked!

Categories : PHP

javascript code being returned through ajax, but not displaying
Try adding an eval() to actually run the Javascript code you're retrieving: function videoGrabber(mirror_id, video_version, firstVideo_version, videoNumber) { jQuery.post("/path/to/my/external/php/file.php", {firstParam : mirror_id, secondParam : video_version, thirdParam : firstVideo_version}, function(data) { //this is your response data from serv console.log(data); jQuery('#videoContainer').html(data); eval(data); }); return false; } BTW be sure you have good security-- eval() has a lot of potential for mayhem if someone can intercept the ajax call and inject their own code. Oh, and since eval() is going to try to evaluate just Javascript code, you need to change your return code to just raw JS code (no <script> tags): z_media = "SQ

Categories : PHP

Get element from AJAX returned data --- $(objSelector, data)
The second argument to the jQuery constructor is the DOM context you want to search inside for the first argument. // Looks for something matching 'objSelector' inside the DOM object 'data' var $content = $(objSelector, data); // Will not work if data is a string Since data is a string, you can do: var $content = $(objSelector, $(data)); To get the #login-form div from within data.

Categories : Jquery

how to do i get returned data from ajax call
your jquery code could be: function formfill(sql) { var username = sql['UserLogin']; var email = sql['UserEmail']; var admin = sql['admin']; var firstname = sql['firstname']; var lastname = sql['lastname']; var title = sql['title']; var company = sql['company']; console.log(username); if (username.length > 0) { console.log('Found user'); console.log(username); $('#username').html($username); } else { console.log('Failed to find user'); } } $('#userlist').on('change', function () { var selected = $("select option:selected").text(); $.ajax({ url: '/php/connect/userdropdowncheck.php', type: 'POST', data: {UserLogin:selected}, success: function(data){ formfill(data) }, error:

Categories : PHP

lua.vm.js ajax callbacks firing but data not returned
Sorry, I just realized I forgot to come back and report the solution. As of jQuery 1.5, all of jQuery's Ajax methods return a superset of the XMLHTTPRequest object. This jQuery XHR object, or "jqXHR," returned by $.get() implements the Promise interface, giving it all the properties, methods,... For example, it contains responseText and responseXML properties, as well as a getResponseHeader() method. Based on this, the following code works and returns the callback data (responseText): local jq = js.get("$") local jqxhr = jq.get("/glossary.json") jqxhr.done(function() print(jqxhr.responseText) end) One could also bypass jQuery altogether with a direct XMLHTTPRequest wrapper function: local xhr = function(method, url, callback) local xhr = js.new.XMLHttpRequest() xhr.onrea

Categories : Javascript

jQuery AJAX POST returned data
would be better if you return the variable from php and iterates the result in the success javascript function. modify the php function and do not iterate the result, return only what fetchAll returns. within PriceCompare function do the following: $STH = $DBH->query('SELECT ProductID, MerchantName, Price, PageURL FROM merchants WHERE ProductID=677 AND Count=' . $countVar . ' ORDER BY Price'); $result = $STH->fetchAll(); return $result; within the php call the function in line 3 as follows: $ data = PriceCompare ($ countVar); and then return that json encoded object. echo json_encode ($ data); finally put dataType: 'json', in $. ajax javascript like this:   $. ajax ({              type: "POST",              data

Categories : PHP

displaying data returned through ajax as link
If the data returned by the php is just the label of the link you may use the following code: $.ajax({//Make the Ajax Request type: "POST", url: "dbtryout2_2.php", data:datastr, success: function(arrayphp) { var link = $('<a href="#" class="my-class">' + arrayphp + '</a>'); $(".searchby .searchlist").append(link); } });

Categories : PHP

Is there any way to execute a MATLAB script through Javascript?
There is no script, at this moment, to convert MATLAB to JavaScript (it's tedious but not impossible to write a parser for M code using a generator like jison). If you posted your MATLAB code, we could find equivalents for some commands (like matrix multiplication ), but there is no general technique. You could also run MATLAB on your server (there is a UNIX version and server licensing) and send commands to a running session from the website.

Categories : Javascript

Trying to find parent selectors outside of ajax returned data
success: function(data) { var serviceTitle = $(data).. In this case, $(data) is not referencing the list item that is currently in the DOM. You are instead creating a new jQuery object from the HTML received from your AJAX request. At this point, the element does not exist in the DOM, and therefore can not be used as a reference point for traversal. .closest(..) would not be appropriate here. Instead, you may want to try something like this: var serviceClass = $(data).attr('class'); var serviceTitle = $('.comments').find('.' + serviceClass).closest('.service-well').find('.service-header').find('h1').text(); After this, the serviceTitle variable contains the correct "service header."

Categories : Jquery

Google App Engine with Ajax: Test the returned data
Try: var menuId = $("ul.nav").first().attr("id"); var request = $.ajax({ url: url, //your url here type: "POST", data: {id : menuId}, dataType: "html" }); request.done(function(msg) { $('#content').html( msg ); }); request.fail(function(jqXHR, textStatus) { //reload here }); source: http://api.jquery.com/jQuery.ajax/

Categories : Ajax

How do I handle image data returned from an ajax get request
Your question is a little confusing so this may not be what you're looking for. Your api should give you information on what type of data it is returning (content type). You can use that to decide what to do with the result. It looks like you're getting a binary image file. You can create a dom image object and insert it into your page to be displayed If you're using straight javascript without a wrapper library it may be something like this: http://xhr.spec.whatwg.org/

Categories : Ajax

How to link and execute a PHP file from a Javascript script?
Forgive me if you know this already, but in case you don't: You are using $.post() in your example, which is a streamlined form of the $.ajax() jQuery method. I suggest using this easier (but larger) format until you are very confident with AJAX. $.ajax() also allows you to do much more than the streamlined (quick) $.post method. I added a couple of input boxes for you to type some information. Also, you need a place to put the stuff to appear on the screen, so I created a DIV for that. Ajax posts data to an external php file, which processes the data it receives, and sends back an answer. It looks like this: FILE #1: <html> <head> <script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script> <script type="text/javas

Categories : PHP

Filtering AJAX returned data and performing .each on selected elements within
The commentsHome variable won't be available to you in the AJAX success function. However, you can create a hidden <input type="hidden" id="commentsHome" /> and store the value in there, then reference that in the AJAX success function. function LoadComments(data) { $newData = $(data).filter('ul.elements'); $newData.find('ul.comments').each(function() { $('#commentsHome').val($(this)); $.ajax({ url: '/MyFeed.aspx', type: 'POST', dataType: 'html', data: { "xfd" : "GetComments', }, success: function(data) { var commentsHome = $('#commentsHome).val(); commentsHome.html(data); } });

Categories : Javascript

Execute javascript function on a page sent via AJAX response
<script> tags inserted into the DOM will not be executed, unless you run eval(). Read more here: Can scripts be inserted with innerHTML? So in your case, test() will be undefined when you try to click on the span because the script code has not been executed (thus never defined the test function). You can get around it using something like this (after the DOM injection): var scripts = document.getElementById("rslt").getElementsByTagName("script"); for( var i=0; i<scripts.length; i++ ) { eval(scripts[i].innerText); } (p.s. eval is not evil)

Categories : PHP

Use value from javascript on html page to execute python script
Here is a simple Python script that pipes the output of a locally executed command (dir on a Windows computer in this case) via a web request (using the excellent web.py library): import web from subprocess import check_output urls = ( '/', 'index' ) app = web.application(urls, globals()) class index: def GET(self): return '<pre>'+check_output('dir', shell=True)+'</pre>' if __name__ == "__main__": app.run()

Categories : Python

Ajax data returned to Symfony partial_include that is recognized by current jQuery / DOM?
To answer my own question, the reason why it would not work is because the Ajax call was bringing in new data that jQuery could not use as the page was already loaded therefore I added onclick to the buttons of the new content that loaded which when fired were recognized by the jQuery thus solving my problem.

Categories : Jquery

Jquery POST and AJAX prepend double space to returned data
There is chance that you've got whitespaces at the end of your included php files (to prevent it, skip ending ?> tag). Also you should check if there is nothing in front of <?php and disable BOM in your UTF-8 files.

Categories : PHP

google maps move marker with lat/lng from ajax success returned data
The google.maps.LatLng constructor takes two numbers for arguments. This won't work: var newLatLang = new google.maps.LatLng(newCoords); You need to convert newCoords into two numbers. Convert String to latlng google maps Convert “[52.43242, 4.43242]” to google LatLng How do I get a pin on Google Maps using location from a variable?

Categories : Javascript

jQuery AJAX returned HTML data anchor tags not clickable in Firefox
The problem had nothing to do with the javascript, jQuery, or AJAX. What was going on was that I had a transparent "mask" div covering my slideShowC div. So my html output layer was covered by a transparency layer. Once I removed the transparency layer, the links were, of course, clickable. Still odd that IE lets me click through div layers. But, ah well, not important at this point.

Categories : Jquery

How to get json result value, returned by controller post action, after data was posted via form, generated by Ajax.BeginForm?
Can't you do this? function onComplete(data) { $('#inputToUpdate').text(data.Prop1 + " " + data.Prop2); } I think the JSON data will be passed as a parameter to the callback.

Categories : C#

how to execute data command that returns a result set in Vb.net SSIS Script Task
To store results in string array. You can use this sample block of code in place of those commented code and adjust the sql statement accordingly. you can store these results in DataTable or in Multidimentional array also. sqlComm = New System.Data.SqlClient.SqlCommand("select Column1 from table ", sqlConn) Dim sqlReader As System.Data.SqlClient.SqlDataReader Dim arrList As New ArrayList() sqlReader = sqlComm.ExecuteReader Do While sqlReader.Read arrList.Add(sqlReader.GetString(0)) Loop

Categories : Vb.Net

Import .CSV data into Javascript and run execute if string contains data
Make a GET request to get the contents of your CSV file (jQuery might help with that), then use a CSV parser (maybe http://stackoverflow.com/a/14991797/711902) to parse the file, then loop through each row, and call the function if it matches your expectation. jQuery.get('urldata.csv', function(response) { var data = parseCSV(response); for (var i = 1; i < data.length; i++) { var col3 = data[2], url = data[0]; if (col3 != 'null') { var site = getSiteFromUrl(url); iimPlay(site + 'Macro.iim'); } } }); function getSiteFromUrl(url) { var site = url.match(///(.*)./)[1]; return site[0].toUpperCase() + site.substr(1); }

Categories : Javascript

jQuery Masonry - AJAX returned data not picking up masonry grid layout after being appended
Try declare masonry itemselector within the function(success) just as soon content is loaded also in a similarcase i encountered, helped to apply $container.masonry('reload'); eg: success: function (data) { $container.imagesLoaded(function () { $container.append(data); $container.masonry('appended', data); $container.masonry({ itemSelector: '.grid_4', }); $container.masonry('reload'); }); }

Categories : Jquery

How to load jsp page some data content dynamically without using javascript or ajax? Because my IE8 browser doesn't support most javascript tags?
jQuery 1.9 (early 2013): We’ll remove many of the interfaces already deprecated in version 1.8; some of them will be available as plugins or alternative APIs supported by the jQuery project. IE 6/7/8 will be supported as today. says http://blog.jquery.com/2012/06/28/jquery-core-version-1-9-and-beyond/ So just try using jquery to send the ajax-request. Below is a small snippet I used from one of my projects. $.ajax({ type: "POST", url: "tradecopy.action", data: $("#tradecopyform").serialize(), complete: function(xhr, textStatus) { $("#innerModalPopupDiv").html(xhr.responseText); } });

Categories : Jsp

Execute LambdaExpression and get returned value as object
Sure... you just need to compile your lambda and then invoke it... object input = 4; var compiledLambda = lambda.Compile(); var result = compiledLambda.DynamicInvoke(input); Styxxy brings up an excellent point... You would be better served by letting the compiler help you out. Note with a compiled expression as in the code below input and result are both strongly typed. var input = 4; var compiledExpression = exTyped.Compile(); var result = compiledExpression(input);

Categories : C#

Pass data to CGI script and back with jQuery.ajax
The problem is in the Perl program. It does not compile. It does not send the required HTTP headers. Add print $cgi->header('text/plain;charset=UTF-8'); or similar and take care to encode the output appropriate for the content type.

Categories : Javascript

Accessing passed data through ajax call in my python script
Inside your python file: import sys import cgi sys.stdout.write("Content-Type: application/json") sys.stdout.write(" ") sys.stdout.write(" ") form = cgi.FieldStorage() sys.stdout.write(json.dumps({ 'data': form.getvalue('ac_number')}))

Categories : Python

In Embedded Octave C++ how do I execute a script file? ("error: invalid call to script")
You should be using the function source_file() rather than eval_string(). Take a look into the parser.h file which unfortunately doesn't have a lot of comments. The names are quite self-explanatory so you shouldn't have a lot of problems. Also, you're pretty much trying to reimplement Octave's source function. If you really want to implement it again, look into the oct-parse.cc file (generated during the build process with flex and bison).

Categories : C++

Refused to execute inline script because it violates the following Content Security Policy directive: "script-src 'self'"
I also faced such type of problem when working with LinkedIn oAuth API. I was using linkedIn API with following settings for cordova config.xml <access origin="*" launch-external="yes"/> <allow-navigation href="*" /> Meta Tag was <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval'"> Script <script type="text/javascript" src="http://platform.linkedin.com/in.js"></script> When i run the application on emulator its giving Fixed Problem to add uri into meta tag http://platform.linkedin.com like <meta http-equiv="Content-Security-Policy" content="default-src *; style-src 'self' 'unsafe-inline'; script-src 'self' 'unsafe-inline' 'unsafe-eval' http:

Categories : Google Chrome

is there any way to automatically execute registerClassAlias on Actionscript/Air?
You can lessen the labor by using an array of classes, which still has to be filled manually. var classArray:Array=[OneClass,TwoClass]; // fill elsewhere for each(var c:Class in classArray) registerClassAlias(getQualifiedClassName(c),c);

Categories : Actionscript

How to execute the method until every Ajax method get data
You can just put insertEntity into getSAS ajax callback: function getSAS() { $.ajax({ url: url, type: 'GET', dataType: "jsonp", jsonp: "callback", jsonpCallback: "jsonCallback", success: function (data) { callback(data); // Get the entity, if it's not global insertEntity(entity); } }); } An alternative is to use when() which can execute a callback when a deferred object finishes.

Categories : Jquery

Need sql commands to automatically execute each line in batch file
What OS? OSQL is old and deprecated. This should get you going for modern OS's (untested). @ECHO OFF SQLCMD /? > nul 2> nul IF ERRORLEVEL 1 ( ECHO.SQLCMD not found on this machine. This program will now exit. PAUSE GOTO :eof ) REM add -h-1 if you don't want header REM Remove REM below for SA REM SET SQLCmdLine=SQLCMD -B -W400 -U "YourUserName" -P "YourPassword" -S "YourServer" -D "YourDatabase" REM Remove REM below for Windows Auth REM SET SQLCmdLine=SQLCMD -B -w400 -E -S "YourServer" -D "YourDatabase" REM Now you can do stuff like REM %SQLCmdLine% -Q "SELECT * FROM.....

Categories : SQL

Execute grails formRemote automatically on page load
I did a quick test. Here is my controller: package test class NothingController { def index() { } def submit() { render "Hello ${params.name}" } } And here is my GSP: <!DOCTYPE html> <html> <head><meta name="layout" content="main" /><g:javascript library='jquery' /></head> <body> <g:formRemote id="myForm" name="myForm" update="updateMe" url="[controller: 'nothing', action:'submit']"> Name: <input name="name" type="text" value="John Doe"/> <input type="submit" value="Go"/> </g:formRemote> <div id="updateMe">this div will be updated</div> <script> $(document).ready(function() { $('#myForm

Categories : Javascript

Ajax in JavaScript sends only the last data in array
Your code actually sends both requests one after another (step 1), in order, like you probably want it to. You get the first debug output due to the asynchronous nature of $.ajax() calls. They send the request and continue with the code execution-- they don't block and they don't wait for the response from the server. That's why your outer/main for loop executes all the way to the end (2 times in your case) before any response is received and the code inside the success callbacks is executed. When the 2 responses are received, the success callbacks are executed (2 times, once for each response), however at that point in time your local variable send2.nama has the value of "2". That's why you get the output "step 2 print 2" twice, instead of "step 2 print 1" and "step 2 print 2". This wi

Categories : Javascript

Add data-ajax="false" to javascript submit
Try function submitFunction(i) { var form = document.sales_order_details; if (i==1) { form.action = "/sales/new_autospread_range?data-ajax=false"; } else if (i==2) { form.action = "/sales/new_previous_order_lines?data-ajax=false"; } else if (i==3) { form.action = "/sales/new_blank_order_lines?data-ajax=false"; } form.submit() } or function submitFunction(i) { var form = document.sales_order_details; if (i==1) { form.action = "/sales/new_autospread_range"; } else if (i==2) { form.action = "/sales/new_previous_order_lines"; } else if (i==3) { form.action = "/sales/new_blank_order_lines"; } form.action += '?data-ajax=false' form.submit() }

Categories : Jquery

JavaScript / Ajax - Check if data on another page is different
Declare var comper; Global Like this: var comper; $.get('getlastupdate.php', function(comperNow) { // comperNow is the latest date/time var // remember the date/time in var called: comper comper = comperNow; }

Categories : Javascript

ajax value not returned
You will need to add one callback, even that you are using sync request the return function will be undefined. function validateEmail(){ email(function(check){ alert(check) }); } function email(callback) { var TCode = document.getElementById('email').value; var result="hey"; $.ajax({ type: "POST", async: false, url: "get_email.jsp", data: "email="+TCode, success: function(html){ $("#email_info").html(html); result=$("#email_info").html(html); callback(result); } }); }

Categories : Javascript

use json data created via javascript with ajax.actionlink
Write a script that uses unobtrusive JavaScript hooks like data- attributes to store the settings. HTML: <div data-ajax-url='/Home/DeleteSelected' data-ajax-post-data='{function name or json content}'> .... </div> JQuery Plugin $(document).on("click","[data-ajax-url]", function(){ var postData = $(this).data("ajax-post-data"); var url = $(this).data("ajax-url"); $.ajax({ url: url, traditional: true, type: "Post", dataType: 'json', data: postData }); }

Categories : C#



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