jsuna30
Forum Replies Created
-
Forum: Hacks
In reply to: Can't get jQuery ajax to worknp! lemme know if you need any more help!
and your problem was not pathetic at all! believe me I was there once!! And still find myself there at times!
Forum: Hacks
In reply to: Can't get jQuery ajax to workah if there is a language selection then there is already a query string in the url ?lang=en?s=…won’t work…instead we need to just do…
var redir = ‘https://colouro.lt/balc/’+qStr;
as far as the checkin date goes…ui datepicker is throwing an error because you use $jQ instead of $
find date = $.datepicker.parseDate(…
and change $ to $jQ…do that wherever you find a $ in the rest of the datepicker initialization…
that may be causing the # or you may still have a handler attached to that field…
Forum: Hacks
In reply to: Can't get jQuery ajax to workahh ok…here’s what you can do…
put this after e.preventDefault(); :var qStr = $jQ(this).serialize();
then change :
var redir = window.location.href
to :
var redir = window.location.href+’?’+qStr;
that should do it!
Forum: Hacks
In reply to: Can't get jQuery ajax to workoops! yes i do believe!! it turned out I needed to clear my browser cache!!…also a gave you another error…
window.location.href = redir
should be
window.location = redir
sorry!
Forum: Hacks
In reply to: Can't get jQuery ajax to workhmmm, I just tried it again on your site….I got the alert…(globals set)…then the redirect…not sure why it’s not redirecting for you…maybe try clearing the browser cache…
few minutes before your sollution I did other thing. I did ajax on form change and it worked fine, but it shouldnt be done like that, couse it calls ajax at least 4 times when user puts hes info ??
yeah..for sure!
Forum: Hacks
In reply to: Can't get jQuery ajax to workhi, sorry, I gave you the wrong handler advise…should create a ‘submit’ handler for the form rather than a click handler for the button…
I put it all together for you here…
https://pastebin.com/VNcYaTAWA couple things to note…I got rid of the .done and .always function because once the redirect happens those functions will no longer be active…you could put the redirect code in the .done or .complete function but it will still cancel the alerts in the .success function…(which should be fine, as the alerts look like they are there for debugging only..)
anyway good luck I hope this’ll work for you!
Forum: Hacks
In reply to: Can't get jQuery ajax to workhi again…I just checked out your site, and tried a search…yeah the redirect is killing your ajax.. definitely need a click handler so you can stop the redirection, until the ajax is finished…then you can redir using
.complete(function(){ //grab current url w/ query vars var redir = window.location.href; //redirect to the current url to preserve origanal submit functionallity window.location.href = redir });
that should clear things up!
Forum: Hacks
In reply to: Can't get jQuery ajax to workahh I see…well one other thing that may be messing it up, is the “die()” at the end of the callback function…wp suggests that you use “exit;”…
I think that when user clicks search submit button, it calls GET method and almost at the same time I call my ajax, that does it with POST. Can it be the problem?
yeah, it might be causing issues as well but only if the page is reloaded before the ajax finishes…does the page reload after clicking submit?
another thing you can try, is make your own click handler for the submit button…$('#submit').click(function(e){ //disable original action e.preventDefault(); //do ajax here });
Forum: Hacks
In reply to: Changing function called in wp-login.php when user log's inHi, found this on stackoverflow…https://stackoverflow.com/questions/1976781/redirecting-wordpresss-login-register-page-to-a-custom-login-registration-page
add_action('init','possibly_redirect'); function possibly_redirect(){ global $pagenow; if( 'wp-login.php' == $pagenow ) { wp_redirect('https://google.com/'); exit(); } }
this should do what you need, without out modifying core files!
Forum: Hacks
In reply to: Action while post is being publishedNp! Another trick I use when validating metabox inputs with js, is I disable the publish button till all conditions are met…
$('#publish').attr('disabled','disabled');
And
$('#publish').removeAttr('disabled');
when all is good!Forum: Hacks
In reply to: ANy help pliz!!!hi! you could try disabling the click function on the image…
<script type="text/javascript"> jQuery(document).ready(function($){ $('img').live('click',function(e){ e.preventDefault(); return false; }); }); </script>
I haven’t tested it but should do what you need…
Forum: Hacks
In reply to: Can't get jQuery ajax to workHi! looks like this…
add_action('wp_head','my_new_ajax_ajaxurl');
should be…
add_action('wp_head','mp_booking_ajaxurl');
based on the code provided…
hope this helps!Forum: Hacks
In reply to: Action while post is being published@michael.mariart makes a fair point, but if you have to have it…
place this in your plugin…
add_action('admin_enqueue_scripts','MY_MESSAGE_JS_FUNCTION'); function MY_MESSAGE_JS_FUNCTION(){ wp_register_script('MY_MESSAGE_JS',plugins_url('message.js',__FILE__),array('jquery')); wp_enqueue_script('MY_MESSAGE_JS'); }
NOTE: you will need to create message.js and put this in it…
jQuery(document).ready(function($){ $('#publish').live('click',function(){ //message to display var msg = '<div class="MY_MESSAGE updated"><p>Post is being saved!</p></div>'; //if there is an 'post updated' message remove it if($('#message').length > 0){ $('#message').remove(); } //if our message isn't on screen already, inject it after the page title 'Edit Page/Post' if($('.MY_MESSAGE').length === 0){ $('.wrap h2').after(msg); } }); });
Enjoy! remember replace all uppercase stuff with your own lowercase names etc.