get

return responseText from jQuery.get()

亡梦爱人 提交于 2019-11-27 03:18:45
问题 I tried to do something like this : var msg = $.get("my_script.php"); I thought msg would be set to the text returned by my_script.php,i.e. the responseText of the jqXHR object. It apparently doesn't work like that as msg is always set to "[object XMLHttpRequest]" Is there a quick 1 line way to do what I want? Thanks. 回答1: After some testing, I ended up finding a solution. I need the call to be synchronous, $.get shorthand function is always asynchonous, so I will need to use $.ajax, like

WCF GET URL Length Limit Issue: Bad Request - Invalid URL

我的梦境 提交于 2019-11-27 03:08:33
问题 I tried to access a WCF Service through jQuery AJAX call with GET method. So, sometimes the URL is lengthy with parameters. When the parameters becomes so lengthy, jQuery AJAX Call fails, and returns nothing. So I put a break point and took the URL out to test. When I try the same URL in the browser (I tried FireFox and Chrome), it returns the following when the URL length is too long. Bad Request - Invalid URL HTTP Error 400. The request URL is invalid. I checked the length limitation as

JSF: Redirect to url as POST not as GET

ε祈祈猫儿з 提交于 2019-11-27 02:48:50
问题 I have an JSF page that redirects via context.getExternalContext().redirect(url); where the url is sth. like login.jsf?token=foobar What I want now is to send the token via POST not via GET request. So that it doesn´t show up in the url, is this possible with JSF? 回答1: It's not possible with HTTP, so also not with JSF. There are however several ways to achieve the requirement. Put it in the session scope. In the bean behind the redirected page, read and remove it from the session scope. Or

Open a PDF in a new window of the browser with angularjs

坚强是说给别人听的谎言 提交于 2019-11-27 02:45:24
问题 I'm new to angular js and I wish to open a PDF document in a new window of the browser after pressing a button. I make a GET request with $http.get() at front end, at backend there is a Java rest service that respond to the GET and generates a PDF. I wish to open this PDF on the browser. If is not possible to open the PDF in this way then at least open any PDF with AngularJs, how could I do this? @GET @Path("/printPdf") public Response printService(){ //generates the pdf File reportFile = new

Different result when using GET/POST in elastic search

a 夏天 提交于 2019-11-27 02:35:24
问题 I am experimenting with elastic search via the Elastic Search Head plugin. The results are as expected when I submit a query via POST. However when I try the same query using GET, I always get back all values in the index. So : how to pass the query to the elastic search server via GET so I can use the search string in an URL? 回答1: If you send a GET the body is probably not even sent to elasticsearch, so you are basically sending no query to the _search endpoint, which is why you are getting

what is kCFErrorDomainCFNetwork Code=303

房东的猫 提交于 2019-11-27 02:15:36
I tried to post my textFiled data to Server.but when posting I got this error: Error: Error Domain=kCFErrorDomainCFNetwork Code=303 "The operation couldn’t be completed. (kCFErrorDomainCFNetwork error 303.)" UserInfo=0x13786c60 {NSErrorFailingURLKey= http://192.168.3.125:8090/SaveDollar/rest/deals/add , NSErrorFailingURLStringKey= http://192.168.3.125:8090/SaveDollar/rest/deals/add } I do not understand this error. Danny S Is a parsing error from the server, when its response can't be parsed. You can look up the error codes in the CFNetworkErrors reference . Make sure you set HTTPMethod to

Sending POST data with GET request valid?

[亡魂溺海] 提交于 2019-11-27 02:08:10
Using Curl for example, I can "post" data in a GET request. Is this a valid thing to do? With that I mean: Is it not forbidden by any RFC specification? Does someone out there use it with good reason? Thanks for any help. See RFC2616 - Hypertext Transfer Protocol -- HTTP/1.1 , section 4.3 "Message Body": A message-body MUST NOT be included in a request if the specification of the request method (section 5.1.1) does not allow sending an entity-body in requests. In section 9.3 "GET" including an entity-body is not forbidden. So, yes, you are allowed to send an entity-body with a HTTP GET request

PHP include() with GET attributes (include file.php?q=1)

雨燕双飞 提交于 2019-11-27 01:54:35
问题 I want to include() a php file located on my server, with additional GET attributes. But it won't work: include('search.php?q=1'); The error it gives: PHP Warning: include(): Failed opening './search.php?q=1' for inclusion Seems like it tries to open a file literally named 'search.php?q=1' instead of opening the 'search.php' file and sending it the GET attributes. *Note that it does work if I don't put any GET attributes: include('search.php'); 回答1: You don't want to do this: You'd have to do

Get Text From <option> Tag Using PHP

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 01:52:33
I want to get text inside the <option> tags as well as its value. Example <select name="make"> <option value="5"> Text </option> </select> I used $_POST['make']; and I get the value 5 but I want to get both value and the text . How can I do it using PHP? serialworm In order to get both the label and the value using just PHP, you need to have both arguments as part of the value. For example: <select name="make"> <option value="Text:5"> Text </option> </select> PHP Code <?php $parts = $_POST['make']; $arr = explode(':', $parts); print_r($arr); Output: Array( [0] => 'Text', [1] => 5 ) This is one

jQuery $.get or $.post to catch page load error (eg. 404)

試著忘記壹切 提交于 2019-11-27 01:51:43
问题 How do you catch Server Error or 404 page not found, when you use $.get or $.post ? For example: $.post("/myhandler", { value: 1 }, function(data) { alert(data); }); That will do absolutely nothing if there is a Server Error loading "/myhandler", or if it is not found. How do you make it notify you if there is an error? 回答1: use error handler on $.ajax() $.ajax({ url: "/myhandler", data: {value: 1}, type: 'post', error: function(XMLHttpRequest, textStatus, errorThrown){ alert('status:' +