w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
Sending POST request in WinForms app and displaying result in browser
The WebBrowser control is your best bet here. The control exposes a DocumentStream property that lets you load content from a stream: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documentstream.aspx You could also use the DocumentText property: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documenttext.aspx

Categories : Dotnet

Make browser's back button work when using hide and show (jquery)
You can use jquery load function to load white part For example; $('#result').load('ajax/test.html'); And in back button event you can load the white part jquery hide and show window.onbeforeunload = function() { $('#result').hide(); }; or window.onbeforeunload = function() { $('#result').show(); }; jquery load function window.onbeforeunload = function() { $('#result').load('ajax/test.html'); };

Categories : Javascript

How can I read the values of a XmlHttpRequest PUT request in PHP
Instead of print_r($post_vars) use echo json_encode($post_vars);. Then in your javascript you want to var response = JSON.parse(oReq.responseText); After that you should be able to reference fields in the response variable. response.post_id Edit: This would be a lot easier with JQuery. Can you include the library? Then add this code: $.post( "http://localhost/cms1/api2.php?type=post", $("#editPostForm").serialize(), function(data){ console.log(data); }, "json"); );

Categories : PHP

Modiying request headers in an XMLHttpRequest
What if you swap: this.setRequestHeader('foo', 'bar'); open.apply(this, arguments); to get: open.apply(this, arguments); this.setRequestHeader('foo', 'bar'); does it work then?

Categories : Javascript

ajax get request in javascript without forms through XMLHttpRequest
Like that. Although if you mean http://www. etc etc, then you do need to remember the http:// part of the URL. Beware the same origin policy and see ways to work around it.

Categories : Javascript

Direct browser upload to Amazon S3
Try adding a wildcard for the AllowedHeader and allow all methods, like so: <CORSConfiguration xmlns="http://s3.amazonaws.com/doc/2006-03-01/"> <CORSRule> <AllowedOrigin>*</AllowedOrigin> <AllowedMethod>GET</AllowedMethod> <AllowedMethod>POST</AllowedMethod> <AllowedMethod>PUT</AllowedMethod> <AllowedHeader>*</AllowedHeader> </CORSRule> </CORSConfiguration> Great starting points for a direct upload to Amazon S3 are: For the js: http://www.designedbyaturtle.co.uk/2013/direct-upload-to-s3-with-a-little-help-from-jquery/ For the php: http://birkoff.net/blog/post-files-directly-to-s3-with-php/ Or if you're looking for a solution that works out of the box, t

Categories : PHP

send post request to website via php (similar to xmlhttprequest)
Try this: $fields_string = "name=bob&lastname=tim"; $ch = curl_init(); curl_setopt($ch,CURLOPT_URL, "http://www.example.com"); curl_setopt($ch,CURLOPT_POST, true); curl_setopt($ch,CURLOPT_POSTFIELDS, $fields_string); curl_setopt($ch,CURLOPT_RETURNTRANSFER, true); $result = curl_exec($ch);

Categories : PHP

XMLHttpRequest to send a GET HTTP request with an username/password
You need to add headers to the XHR request manually. xml.setRequestHeader("Authorization", "Basic " + btoa(username + ":" + password)) Demo here: http://jsbin.com/inuhiv/2 (NOte, there is nothing to auth, however look at devtools and see the request has auth header)

Categories : Google Chrome

Second call out of two xmlhttprequest doesn't work
Use setTimeout to separate the calls, and with to encapsulate the XMLHTTPRequest: function xhr() { with(new XMLHttpRequest) { open("GET",{},true); setRequestHeader("Foo", "Bar"); send(""); onreadystatechange = handler; } } function handler(event) { !!event.target && !!event.target.readyState && event.target.readyState === 4 && ( console.log(event) ); } setTimeout(xhr, 500); setTimeout(xhr, 1000);

Categories : Javascript

InvokeMember give a different result than direct call
only way for me to reproduce this issue under windows 7 64bits with vs 2012 is to have an invalid rootFolder like an empty string or crap data in that variable. can you do a breakpoint on that line: Dim folder = shell.BrowseForFolder(0, message, &H241, rootFolder) and check what is rootFolder ? found a way try this; Dim folder = shell.BrowseForFolder(0, message, &H241, rootFolder.ToString()) my code: Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Dim rootFolder As Object = "f:" Dim shellType As Type = Type.GetTypeFromProgID("Shell.Application") Dim shell = Activator.CreateInstance(shellType) Dim folder = shell.BrowseForFolder(0, "message", &H241, rootFolder.ToString()) End Sub

Categories : Dotnet

jQuery cross domain AJAX request fails with XMLHttpRequest cannot load error
Your best bet is to create a REST/JSON service on your own web server that simply returns the remote results from Google's API. That way any cross-domain problems are avoided and you have more control over future changes to the API (you can for example reformat the content to suit your own nefarious uses:)).

Categories : Jquery

How to achieve a simple re-direct to a GET request?
Yes you are allowed to do this (why shouldn't you be?) Yes, you can get the query values from the $_GET superglobal array. More specifically, $_GET['uid'] will contain the text 'johnny' (without the quotes of course).

Categories : PHP

Amazon S3 direct file upload from client browser - private key disclosure
You're saying you want a "serverless" solution. But that means you have no ability to put any of "your" code in the loop. (NOTE: Once you give your code to a client, it's "their" code now.) Locking down CORS is not going to help: People can easily write a non-web-based tool (or a web-based proxy) that adds the correct CORS header to abuse your system. The big problem is that you can't differentiate between the different users. You can't allow one user to list/access his files, but prevent others from doing so. If you detect abuse, there is nothing you can do about it except change the key. (Which the attacker can presumably just get again.) Your best bet is to create an "IAM user" with a key for your javascript client. Only give it write access to just one bucket. (but ideally, do not

Categories : Javascript

Amazon S3 direct uploads via forge.request.ajax
Looks like this was just a bug in the Trigger upload code, I've just published an updated version of the request module (version 2.2) which fixes this. Thanks for such a detailed description of your problem.

Categories : Amazon

What is the direct cause and source of the "Sorry, an error occurred while processing your request." message?
The default error handling of an out-of-box ASP.Net MVC Application redirects errors to the Error.aspx shared view. You will find the "Sorry, an error occurred while processing your request" message text inside the Error.aspx file. The message is not generated from a .Net class. The following SO question brought me to the light: ASP.NET MVC HandleError not working (customErrors is set to "On") To see more details about the underlying error you have a few options. Customize the default Error.aspx page to display details about the underlying error. Turn off the CustomErrors in the web.config file. Future errors should display the default ASP.Net "yellow screen" error details instead of the "Sorry, an error occurred message". Handle the error specifically in the associated Actio

Categories : Asp Net Mvc

Curl request showing different content from that of browser request
Making request through cURL and manually in browser can display different contents even if you have submitted the same URL parameters in both cases. The reasons can be few. POST Data: Your browser is sending some POST data which you forgot to send in case of cURL. Cookie: Your web browser is sending some cookie to the server which is required for the content to display. IP: It is not a trouble in case of local server but can vary in case of a web host.

Categories : PHP

Any way to know if a XMLHttpRequest has completed within a separate XMLHttpRequest scope?
jQuery's ajaxStart() only fires for the XMLHttpRequests come from jQuery itself. One alternative approach may be to maintain a counter by yourself, increasing it after xhr.send and decreasing it in onreadystatechange function.

Categories : Jquery

entry in input one by one should show added result in result field
If you are using chrome, then console is your best friend ( https://developers.google.com/chrome-developer-tools/docs/console ) For firefox you have firebug, opera has dragonfly (or something like that ?). Even IE has console now. There you can see all errors popping up. Ok, so first of all let's clean up this a little bit by wrapping it all in closure (we can now safely use the $ instead of jQuery even if there is namespace conflict outside). Also, we will use single function for both cases, because they are so similar. !function ($) { $(".txt-email").keyup(setValue); $('.rdbtn-style-social').change(function(e) { setValue(e, true) }); function setValue(e, radio) { if('undefined' === typeof radio) radio = false; var attr = radio ? 'name' : 'id'; var

Categories : Javascript

WWW server reports error after POST Request by Internet Direct components in Delphi
I'm very sure that I'm POSTing the right data Since it does not work - obviously you do not (or Delphi does not - that makes no difference for server). You should start usual debugging loop: Observe reference working behaviour. Observe your program behavior Spot the difference Eliminate the difference Check if the program works now If not - go to step 2. Reference implementation would be some WWW browser working with site: Opera, Chrome, Firefox, MS IE, etc. Observing tool would be some HTTP Sniffer like WireShark or OmniPacket or Microsoft Net Monitor or else, however this tinkers with OS work on rather deep level. Or it can be local proxy with GUI, like Proxomitron or Membrane Monitor - but that would require special setup for both the program and the browser, to route their

Categories : Delphi

"XMLHttpRequest cannot load Origin is not allowed by Access-Control-Allow-Origin" Error for invoking SOAP request
You'd need to modify your GET request to be a JSONP request. How to make a JSONP request from Javascript without JQuery?

Categories : Rest

table name = null; NullPointerException Failure delivering result ResultInfo{who=null, request=1, result=-1, data=Intent
It's my problem mates.. the database is still not open.. For that, I called db = this.getReadableDatabase inside the exists method... Thanks for replies... Regards

Categories : Java

AngularJS HTML5 Mode - How do direct links work without server specific changes?
The AngularJS documentation does in fact mention this Server side Using this mode requires URL rewriting on server side, basically you have to rewrite all your links to entry point of your application (e.g. index.html) In this case, one Java-based solution is to tell the server "map all urls to index.html." This can be done in any HTTP Server or container. I implemented this using Java/Servet since I want my application to be HTTP server agnostic (ie Apache versus NginX, or Tomcat/JBoss only). In web.xml: <welcome-file-list> <welcome-file>index.jsp</welcome-file> </welcome-file-list> <servlet> <servlet-name>StaticServlet</servlet-name> <jsp-file>/index.jsp</jsp-file> </servlet> <ser

Categories : Java

Spring3 doesn't work @valid when json request I got 400 Bad Request error
Data binding (mapping request to objects) is an independent process from data validation. In Spring, data binding can contribute with its own binding errors to overall validation errors. Binding errors are supported by Spring's standard WebDataBinder, which kicks in when the method parameter is annotated with @ModelAttribute With @RequestBody annotation a completely different mechanism is used - HttpMessageConverters (in you case probably the MappingJackson2HttpMessageConverter). When the JSON unmarshalling fails a HttpMessageNotReadableException exception is thrown. You can handle exceptions within your global HandlerExceptionResolver or a special @ExceptionHandler annotated handler method within the handler itself or a global @ControllerAdvice.

Categories : Json

Different result from browser and from mobile
Ok, at least, i found the problem. I wrote a little app, what is try to use these requests. As i mentioned, in the browser was everything was fine. I never tried to use net from android till now, but now i did it, and when i want to log in the user, logcat says: 07-16 12:52:42.890: W/ResponseProcessCookies(9125): Cookie rejected: "BasicClientCookie[version=0,name=wordpress_d0c0d54098055ddfb5fe7a1313b4d3b5,domain=.anydomain.com,path=/wp-content/plugins,expiry=null]". Illegal path attribute "/wp-content/plugins". Path of origin: "/service/app_request.php" So that was thy developer can not log in the user on the phone... Unlucky, i am not familiar with android in this depth, so i do not know the solution for this. I've checked the cookie problem at here: Java HtmlUnit - can't login to

Categories : PHP

getting undefined result on browser console
Try this: x = eval(x); return x; and remove the while(x=eval(x)); Fiddle

Categories : Javascript

AFHTTPRequest result null (even though I can see JSON in browser)
Add HTTP response headers when you send back the data. At least Content-Type and, preferably, also include Content-Length. This will allow the AF classes to understand what to do with the received data.

Categories : Java

Force browser to re-read ajax result
you can either set cache: false in your $.ajax() call or if you want the caching to affect all the requests in a given page you can do $.ajaxSetup({ cache: false; }); This will add a _=32409035094 to the query string being a parameter named _ and a value of the current timestamp. This creates a unique request string causing the request to be read from the server rather than the cache.

Categories : PHP

JCR SQL2 - result query order as in JCR browser
The only way to specify the order of the query results is to use an ORDER BY clause in your query. If you don't, the implementation is free to return the nodes in whatever order it wants. But I know of no way in JCR-SQL2 to specify the "natural order" (my term) of child nodes under a parent.

Categories : Misc

How to display restful request and response on the browser. My client wants to debug the request and response from client application
There are plenty of browser plugins that'll let you construct a request to RESTful services. My favorite is Postman for Chrome It'll let you type in the URI, required headers, and body, and displayes the results. Very useful for debugging RESTFul services.

Categories : Java

Which browser returns the correct result for getBoundingClientRect of an SVG element?
This Firefox bug is fixed now, the fix is already in Firefox nightlies and should make it through to Firefox 33 which will be released on 14 October 2014. See bug 530985 for details.

Categories : CSS

Would an empty src attribute cause a request on any browser?
you can use it like this <img src="" width="30" height="20"/> you can still set it in client-side script the easiest test is the code below <html> <body> <h1>My First Heading</h1> <img src="" /> <p>My first paragraph.</p> </body> </html> if you save this code as an html file in your local computer, then open it in chrome. press F12 . you will see DEVELOPER CONSOLE opens. click the NETWORK tab. when you reload the page, you will see it only requests the html file. but if you give a dummy source like below <img src="test.png" width="30" height="20"/> when you reload the page with "test.png", you will see it makes a request for html and image. but if you leave blank the source like src="", it wont make a request

Categories : HTML

detect request from mobile app not from browser in php
I assume that you're using an NSURLRequest somewhere... Create a mutable request NSMutableURLRequest and set the header you want to check for in the PHP (using addValue:forHTTPHeaderField:).

Categories : Iphone

Comparing browser request to directories
You are trying to compare a string to an array of strings. This can't work. You need to check if the wanted string is present in the array. Something like: if (files.Contains(Request["ftpload"])) Or a loop: foreach(string file in files) { if(file == Request["ftpload"]) { return true; } }

Categories : C#

Ext.Ajax.Request not working in Browser
Check your debug console, you most likely will see an error about the same origin policy. If nothing else try opening chrome with the --disable-web-security option to see if it helps. See this question for exact syntax. Good luck, Brad

Categories : Ajax

Can't display the output result in browser returned from htmlentities() function in php
That is what htmlentities is supposed to do. Just echo the string out and it should implement the HTML automatically. $str = "A quote is <b>bold</b>"; echo $str;

Categories : PHP

Show children of direct parent without specifying parent id
You can get the parent id through the following: $post->parent_post So, you could do something like: $parent_id = $post->parent_post; $pages = get_pages('child_of=' . $parent_id); if ($pages) { ... }

Categories : Wordpress

Show div in every browser apart from IE
I don't recommend you do it this way! First of all, browser detection is evil and you should avoid it where possible. Feature detection using something like Modernizr is far more user-friendly. Remember that a lot of users (all mobile users, Mac users, Linux users) will not have the option of using IE even if they want to. Having said that, it IS possible... OK, let's say your HTML is this: <div id='notOnIE'>Some content, do not display on IE.</div> Hide the DIV in IE9 and earlier: First of all, let's detect IE9- and make this DIV invisible in IE: <!--[if IE]> <style type='text/css'> #notOnIE{ display:none; } </style> <![endif]--> Hide the DIV in IE10: Now, we need to hide the DIV in IE10, add this to your CSS stylesheet: @med

Categories : Javascript

Result of request SQL Server
You can use the IS operator to compare with NULL. Replace ass.resilie<>1 with (ass.resilie IS NULL OR ass.resilie <> 1)

Categories : SQL

ajax request being set cookies not showing in browser
Have you checked these parameters (path of cookie, domain, expiry) well while setting cookies? Try this: $.ajax({ type: 'POST', url: myUrl, success: function(output, status, xhr) { alert(xhr.getResponseHeader("'Set-Cookie'")); }, cache: false });

Categories : Ajax

Sending non-RFC compliant HTTP request in browser
In an HTTP header, it looks like GET http://www.stackoverflow.com/ HTTP1.1 If you don't escape spaces in the URL, it will break the HTTP header. No HTTP compliant server will be able to understand the request. However, if you do have a legitimate reason to do this, you can just write the data to a socket and send it to the server. See Java Sockets on Oracle's tutorials for more.

Categories : Java



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