I was using add this share plugin.I am creating dynamic data url from ajax call.
My code was:
addthis.init();
$('.addthis_sharing_toolbox').attr('data-url',dta);
My problem current page url only sharing. I need to send my custom url. Any answer will be appreciated.
First, make sure the variable dta has the URL you'd like to use. Then, follow the instructions on this page to update the URL and title that are shared: http://support.addthis.com/customer/portal/articles/1692927-using-dashboard-configuration-tools-dynamically
Specifically, call the addthis.layers.refresh() function.
Related
How to add AJAX code inside a Joomla article by using a third party module like Flexi Custom Code?
I have a form inside my article and want to make a submit for this form without refreshing the page.
I read some pages talking about this, but I did not understand how to.
We have written an exhaustive and easy to use guide on how to use Ajax in Joomla. You can find it here.
In short, you will need to create a function ending by "Ajax" in the module in question that will check for the submitted information and that will return an output according to the submitted information. A valid function name can be funcAjax. Just make sure you pass "func" as the "method" in the ajax URL call.
You can use free extension like sourcerer Using this plugin, you can very easily insert html and javascript codes inside article.
here is a video tutorial on how to use it. https://www.youtube.com/watch?v=LiFa1Jq8igQ
I have a website layout divided into the multiple partial files. One of them is a view which seats in the sidebar. There is a link in it (Facebook Connect), when I press it, it call a specific function, when it's completed without any errors, i received a blank page.
How to program it, so after processing a function inside another Controller, it will stay at the same url ?
Here is a visual. Imagine that I'am on this url http://localhost/web/blog. Here, on that page, i have a sidebar loaded with a link in it, which once it's pressed it will process a function. The url of this link in the sidebar is http://localhost/web/member/facebook_login.
After it's done, it should stay on the same url http://localhost/web/blog instead of /web/member/facebook_login.
Is it possible to do it without using a redirect() function ? So it will stay on the same page whenever you are, if your url is /web/home or web/about-us etc. ?
Thanks in advance guys
Why using the HTTP referrer is a bad idea, i just explained in my comment.
The url of this link in the sidebar is http://localhost/web/member/facebook_login
Then you should put the URL of the current page into that link, as a parameter:
http://localhost/web/member/facebook_login?go_back_url={url_of_the_current_page}
Then, after successful login, you can use the value of the parameter go_back_url to redirect back to the address it contains.
Found it!
Instead of using redirect('somecontroller/somefunction/someslug') you can use user_agent library.
redirect($this->agent->referrer());
Along by loading the user_agent library to make it possible $this->load->library('user_agent');
I currently have 2 pages:
Follow.php:a PHP page which is all setup with twitters api and will follow any user on twitter with the specific parameter you put in.
One index.php page, which has a list of links of people you can follow.
What I am looking to do is have it so when a user clicks on one of the people to follow on index.php, the variable in follow.php (which is used as a parameter and is the username of twitter account that is going to be followed) gets set to the name attribute of the link selected.
Now I am not the greatest developer, so I am not sure of the best way of doing this. There is probably a better way of doing it that what I am thinking of. I was thinking of using jquery to say something like:
$('a').click(function(){
<?php $group=?>$(this).attr('name'); //trying to set a php variable to name attr
})
This was going to be in its own new file,
then I was going to include this script into the follow.php script and use the variable. This is not working, unsurprisingly. I hope I explained what I was trying to do well.
So I have two questions.
Number 1:what is the best way of achieving what I am trying to do? can i do this all in php?
Number 2: is it possible to do what I was trying to do with jquery and setting the php var equal to the name attr?
PHP runs on the server. JavaScript (jQuery) runs on the browser. PHP can be used to write JS, but JS can't affect PHP (except via AJAX or similar).
What you need to do is do a POST on the Follow.php page and accept the username value. This is a great resource for that: http://www.html.net/tutorials/php/lesson10.php
You can simply set the link href for each tag on the index page to go got Follow.php?user=twitterHandle (where twitterHandle is the twitter username of a person). This way, you dont need to use any javascript at all.
I'm trying to implement a Facebook connect button to my website.
It's working, but it's written in JavaScript and I'd like to insert the information into the database (the tutorial I used is linked below.)
I'm trying to redirect the users from the index.php to index.php?name=xxx.
The name value is rendered with JavaScript so I can't simply just set a PHP variable, can I?
I've been told it's possible with $_GET so that's what I'm trying to achieve.
Using location.href/replace, both redirect to the same page over and over again...
This is the tutorial I used.
I would like to store some information in the database, but I can't do it directly since it's JavaScript and not PHP.
Is there a solution/any other way?
check if the name parameter is filled or not, and if it is, do not redirect
I'm working on a little widget that will allow to embed like an iframe (but with a jQuery plugin) a part of my website.
I've successfully made a search.php API that produces in JSONP what I need to retrieve. It works! (thx to this community ;) ). I had difficulties to understand and use right callback request to allow a distant server to retrieve info on mine.
Now, I'd like to do the other way of interracting: writting :ask a question, vote for an answer.. I've made pages that accept GET parameters to do that.
For example, if I call myserver.php/vote.php?id_vote=xxx I add a vote to the answer xxx in my database, and return 1 ok status. But it appears to work not as easily as if I were on my server..
How can I call this vote.php page on another server, using jQuery and $.Get or $.ajax?
Thanks a lot
You can perform your Ajax call on a php page which contain
echo file_get_contents('url');
But you need to have allow_url_fopen activated.
I've solved my problem, in fact, I used the same way as in this thread:
How to make a search.php API
I return my 0 or 1 status in JSON and make a correct JSON ajax call.