Jquery Post Error 301
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about 301 moved permanently ajax post Stack Overflow the company Business Learn more about hiring developers or posting ads
Jquery Ajax Don't Follow Redirect
with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow
301 Moved Permanently Error Fix
is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up jQuery ajax call returning with a 301 moved permanently error in wordpress up
Jquery Ajax Handle Redirect
vote 2 down vote favorite i am using proxy.php to call an api with jquery ajax. But it returns 301 error. In my local pc it seems to receive the data but not trigger the success function. Here is the code: var url = "http://api.yelp.com/business_review_search?term="+encodeURIComponent(term)+"&location="+zip+"&cc=US&ywsid="+ywsid+"&limit=10"; //alert(url); jQuery.ajax({ url : template_directory+"/proxy/proxy.php", type:'GET', dataType: 'json', data:{ proxy_url:url }, success: searchResult, error: showError }); Also tried the get_json version of the code but 301 moved permanently curl same result? The proxy.php is now in a directory and calling the proxy like this: url_to_the_proxy.php?proxy_url=url_to_call_api I think the wordpress redirecting might cause this problem but don't have experience how to fix it. Waiting for your reply. Thanks! Sorry here is the page. Use the search function http://beta.citystir.com/entertainment/ jquery ajax json wordpress api share|improve this question edited Aug 12 '12 at 13:55 Dan Atkinson 7,571105995 asked Apr 1 '11 at 18:13 Sisir 80011840 301 is not an error, it's a redirection code. But jQuery should follow those. Where are you getting the 301 from? –Pekka 웃 Apr 1 '11 at 18:19 hi, i forgot to add the url. Please check the search function under the navigation bar. –Sisir Apr 1 '11 at 18:21 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote Sounds like the path to your proxy is incorrect. The template_directory variable is called, but you need to use a URL, not a path. Be sure it's the public facing path. If you're using it locally you can usually call files like file: file:///Users, however that may not fly with jQuery. I'd suggest setting up a local apache server with WAMP or MAMP and trying
0 January 2012 edited January 2012 in Bug reports I've got a site that's returning a 301 error when using dataTables with an Ajax source, and the table just hangs with the processing message. However using jQuery Ajax requests outside DataTables works OK. I can't see anything in the forums about this - just wondering if anybody's got any ideas? I'm running DataTables 1.8.3dev from 16 Sep 11 and jQuery 1.6.4. It's dificult for me to update the site with the latest jQuery and DataTables, so I haven't been able to test whether the problem's still there with the latest versions. Campbell Replies http://stackoverflow.com/questions/5517176/jquery-ajax-call-returning-with-a-301-moved-permanently-error-in-wordpress allan Posts: 35,798Questions: 1Answers: 3,780 Site admin January 2012 301 isn't an HTTP error code - it means that the resource has moved. The browser's XHR control should automatically follow the redirect. Can you give us a link to your page please? Allan greenflash Posts: 42Questions: 1Answers: 0 January 2012 Thanks. I'll send you a link off-forum. Campbell allan Posts: 35,798Questions: 1Answers: 3,780 Site admin January 2012 Thanks https://datatables.net/forums/discussion/8241/301-error-with-ajax-source for the link :-). Talked to Campbell offline about this, but for anyone else interested in this post in future the issue was a cross domain request. The page loaded was https://, however the Ajax request for the table data was http://. So: Instead of loading from: http://domain.com/ Instead just use a relative URL: / Allan greenflash Posts: 42Questions: 1Answers: 0 January 2012 Many thanks for the fast response Allan - this fixes the problem. Campbell This discussion has been closed. Sign In · Register Howdy, Stranger! It looks like you're new here. If you want to get involved, click one of these buttons! Sign In Register Categories Recent Discussions Unanswered Categories 37.2K All Categories50 Priority support 13.5K Free community support 12.5K General 144 Announcements 4.8K DataTables 1K DataTables 1.10 2.7K DataTables 1.9 836 DataTables 1.8 3.6K Extensions 8 AutoFill 82 Buttons 22 ColVis 1.9K Editor 26 FixedColumns 182 FixedHeader 21 ColReorder 83 KeyTable 22 Responsive 12 RowReorder 23 Scroller 28 Select 1.2K TableTools 1.4K Bug reports 216 Feature requests 890 Plug-ins 35 Blog 47 Web-site Forums Powered by Vanilla DataTables designed and created by SpryMedia Ltd © 2007-2016. MIT licensed. Our Supporters SpryMedia Ltd is registered in Scotland, company no. SC456502.
- general The 301 response from the Web server should always include an alternative URL to which redirection should occur. If http://www.checkupdown.com/status/E301.html it does, a Web browser will immediately retry the alternative URL. http://codeblow.com/questions/jquery-ajax-call-coming-back-having-a-301-moved-permanently-error-in/ So you never actually see a 301 error in a Web browser, unless perhaps you have a corrupt redirection chain e.g. URL A redirects to URL B which in turn redirects back to URL A. If your client is not a Web browser, it should behave in 301 moved the same way as a Web browser i.e. immediately retry the alternative URL. If the Web server does not return an alternative URL with the 301 response, then either the Web server software itself is defective or the Webmaster has not set up the URL redirection correctly. Fixing 301 errors - CheckUpDown Redirection of URLs may occur for 301 moved permanently low-level URLs (specific URLs within the Web site such as www.isp.com/products/index.html) when you reorganise the web site, but is relatively uncommon for top-level URLs (such as www.isp.com) which most users specify for their CheckUpDown accounts. So this error should be fairly infrequent. The 301 response from the Web server should always include an alternative URL to which redirection should occur. If it does, CheckUpDown automatically tries the alternative URL. This in turn may possibly lead to another redirection which CheckUpDown then tries. This continues for a maximum of 5 redirections. As soon as 5 redirections have occurred, CheckUpDown gives up and reports the 301 error for your account. So you should only ever see the 301 error if 1) the Web server gives no alternative URL on the 301 response or 2) the number of redirections exceeds 5. This second condition should be fairly unlikely - and may indicate a recursive pattern e.g. URL A redirects to URL B which in turn redirects back to URL A. You first need to check
not trigger the success function. This is actually the code: var url = "http://api.yelp.com/business_review_search?term="+encodeURIComponent(term)+"&location="+zip+"&cc=US&ywsid="+ywsid+"&limit=10"; //alert(url); jQuery.ajax({ url : template_directory+"/proxy/proxy.php", type:'GET', dataType: 'json', data:{ proxy_url:url }, success: searchResult, error: showError }); }; Also attempted the get_json version from the code but same result? The proxy.php has become inside a directory and calling the proxy such as this: url_to_the_proxy.php?proxy_url=url_to_call_api I believe the wordpress redirecting could potentially cause this issue try not to have experience how you can repair it. Awaiting your reply. Thanks! Sorry this is actually the page. Make use of the search function http://beta.citystir.com/entertainment/ jquery ajax json wordpress api Related Database to trace user notices or activity (Facebook like) Drop able contraint problem Wordpress - Apache FollowSymlinks for styles, using Mac lion Child pages disabled in IE Could it be advantageous to secure usernames saved within the database? Lessons for .Internet database application using SQLite Symfony 2: Build own DB access layer How you can fetch data from database on scroll? Static method calls to derived types over virtual implementations? (Android) How you can rewrite my url? How do i prevent a primary food selection with sub products from being clickable in Wordpress? Apache mod_rewrite redirect to internal server How to locate one groups all posts' all category? And again specific category form individuals groups.? Hosting an internet server with an image SQLite / Firebird embedded for number data How you can add and share source code files inside a WordPress based site? wordpress - call a function whenever a comment is published Determining a thing press site Database development organisation .htaccess problem with my domain title