I am developing a jobsite. I like to load career advice from anywhere (like blog, other sites, rss, etc.), and it should be updated automatically if there is a change in source.
How can I achieve this, and from where I can get the required content?
Perform an Ajax request on a time interval, if there are changes, then update the content on the page
Ajax with jquery: http://api.jquery.com/jQuery.ajax/
Related
I inherited a site that's completely built using Ajax so I'm using this code to detect pageloads:
(the standard GA code)
var _gaq=[["_setAccount","UA-#######-#"],["_trackPageview"]];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
s.parentNode.insertBefore(g,s)}(document,"script"));
and the gaq.push:
_gaq.push(['_trackPageview', '/#pagename']);
except this is a big site with over 30 pages and I dont want to have to write in every one. is there a script that can find the paths/pagenames and put it in there for me?
I don't know Ajax OR Javascript, so apologies if this is not worded correctly.
You can use the _push function however because an AJAX request can mean so many things (sometimes a page load, sometimes a postback of data, and sometimes just a ping to make sure the user is still alive) you wouldn't want to track every XMLHttp request.
Depending on what language your site is written in, I would strongly suggest making use of some form of partial page component (php include, ASP.NET MVC Partial, ServerSide Include) etc which would stop you re-writing the code a million times if you change it.
However you will still need to edit your 30'odd pages if they are hard-coded. Or one master page if its a sensible design.
Check out this link for a sample on how to track ajax requests using the push method.
I'm working on a website which has been developed in plone. Now I'm facing an issue, I would like to load certain content from a template via an ajax call on normal Plone page(on some event trigger).
Do I need to create any python script??If yes where has it to be placed? and moreover how do I integrate it with TAL(I guess that would be needed) but I'm not sure how.
Could anyone guide me on this with necessary pointers/docs that I should look into?It would of great help to come over my issue and get things rolling.
Thanks,
Avinash
In the "Plone Developer Documentation" there's a section for Javascripting in Plone that perfectly fits your needs
Your question is a bit vague:
From your question, it seems that you just want your ajax call to return html to populate data on the page somewhere then?
Also, it sounds like you want to do the development TTW in the ZMI? Most developers would would use an add-on product and return your ajax response.
However, you can do it TTW with page templates just fine.
Create the new page template
populate it with the template code that gives you the desired output when called within the context of content on a site. For example, http://mysite.com/plone/page/my-template
in your javascript, use a url that in the ajax call: $.ajax({url: 'http://mysite.com/plone/page/my-template', success: function(data){ $('#content').append(data);}})
It's not really anything special to do ajax within plone--just use the tools available and piece it together.
My website uses ajax.
I've got a user list page which list users in an ajax table (with paging and more information stuff...).
The url of this page is :
/user-list
User list is created by ajax. When the user click on one user, he is redirected to a page which url is : /member/memberName
So we can see here that ajax is used to generate content and not to manage navigation (with the # character).
I want to detect bot to index all pages.
So, in ajax I want to display an ajax table with paging and cool ajax effetcs (more info...) and when I detect a bot I want to display all users (without paging) with a link to the member page like this :
JohnBob...
Do you think I can be black listed with this technique ? If you think so, could you please provide an alternative solution by keeping these clean urls and without redeveloping the user-list (without ajax) ?
Google support a specification to make AJAX crawlable:
http://code.google.com/web/ajaxcrawling/docs/specification.html
I did an experiment and it works:
http://seo-website-designer.com/SEO-Ajax-Google-Solution
As this is a Google specification, you won't get penalised (unless you abuse it).
Saying that, only Google support it at the moment (AFAIK).
Also, I believe following the concept of Progressive Enhancement is a better approach. That is, create a working html website then make the JavaScript enhance it
Maybe use the urls with an onclick to trigger your AJAX scripting? Like
Some URL
I don't think Google would punish you for this, you primarily use JScript, but you do provide a fall back for their bot, so your site doesn't get any less accessible.
EDIT
Ok, I misunderstood. Then my guess would be you basically have two options:
1. Write a different part of your site where bots end up, or,
2. Rewrite your current site to for example always give a 'full' page, with an option to only get, say, the content div. Then you can get only the content with JavaScript, but bots will always get a nice page.
I'm using the SMCF Wordpress plugin on this site: http://fingelly.com/
As you can see it uses ajax to post the form fields to get mailed and then updates the modal.
Some of the nav options at the site take you to a 3rd party IDX (real estate listings) provider. For example click on the tabs marked agents and the url changes to fingelly.idxre.com...
As you can see the html is customizable there... I had tried adding the same simple modal contact form to my template there but encountered a problem because I cannot post using ajax to my wordpress driven site from this other domain.
I understand this limitation is for security reasons to prevent xss. How would you suggest working around it in this case?
For now we've simply removed the contact tab.
If you just need to send information to the server and not worry about the response, you create a hidden iframe on the page and post the data there. You could also make a JSONP call if the data would fit in a GET.
Hi Masters Of Web Development.
I have a not that simple question this time. I have got a simple external HTML page, that I want to include in my site. The HTML page contains a submit form or something like that, and I wish to send this data from the form, without to reload the whole page. So I decided to put HTML page inside iframe. But, some people said that this is older technology, google doesn't like iframes, etc. So I want to use something like AJAX or JQuery to load that external HTML page, and to send submit form without reloading the whole page with it. :)
Any suggestions on how to make this?
Thanks in advance :)
Do you really need Google to index that iframe form? If that's the only iframe you have throughout the site, it aint going to be a problem in terms of google indexing.
About using the Iframe, if you are not comfortable learning and building ajax-type form, you'll still be fine (like what Frankie commented). Just make sure the form works, usable and compatible with popular browsers.
You want to use the jQuery Forms Plugin. Its very straightforward and easy to turn any normal HTML form into an AJAX form.