Can I make simplemodal contact form post across domains? - ajax

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.

Related

Eloqua From Submit Via Ajax

I have an Eloqua from with one simple e-mail field on it but I would like to send the data via Ajax to prevent the page from refreshing. I've been looking around on the internet but didn't find anything that's working so far..
Anyone has experience with this?
Thanks.
Ajax probably won't work because of domain restrictions.
You could have a look at blind form links, though:
http://img.en25.com/Web/McAfee/blind-form-link-generator-v2.html
This page generates a link for you, parameters are basically the form field names as set on the form.
This is a simple http request, which will post your data to the form specified.
You can use it as an iframe src, or even an img src. Data will be submitted, page won't reload.
Edit regarding Seb's complaints:
The link was provided as a helper. Please note that the generator creates a link which uses &e= for the email address field value.
I have senn this fail many times, so please use the original form field name set on the eloqua form.
If you are using Eloqua Landing pages or external pages, they will most likely be hosted on a subdomain (Eloqua) or the main domain (external page) of your organization, while all form submits go to a subdomain of eloqua.com.
This means ajax will be blocked. Hence the workaround using the "blind form link" in an iframe, for example.
This link is always the same structure. Example:
http://now.eloqua.com/e/f2.aspx?elqFormName=elq-form-name&elqSiteID=123456&emailAddress=EmailAddress&firstName=value&lastName=value&checkbox=1
You can use now.eloqua.com/e/f2.aspx for all blind form submits.
The parameter "elqFormName" specifies what form the data is being sent to.
"elqSiteID" is necessary to identify your Eloqua instance.
All following parameters refer to the HTML name given for the field on the Eloqua form.
If you send a blind form submit, all processing steps in Eloqua will be triggered, but used in an iframe or img tag for "fake ajax" will not trigger any redirection set on the form in Eloqua.

Using securesocial services without using its views

I started integrating SecureSocial in my play/scala app, but I don't really like all the redirects it does between it's different views.
example - try to login from it's default login page and if you put in a wrong pass you will be redirected to a different page (url) but with the same login form. the only thing that is different is that there is an error message...
I want a simple login form (user/password provider) at the corner of my main page that submits it's data using ajax, this data is validated on the server and a response is made to either display error message/s or change the window.location.
Next to this form I will put a link to go to a more advanced login page that adds the option to use other providers like fb/twitter etc..
But from that page I also want to use ajax to submit the details and get the response.
I tried to browse into the SecureSocial source but got a little lost in there.
Can any one give me an idea how to use SecureSocial's but without using any of it's views?
NOTE: I'm not interested in customizing their views, It's not just a CSS/design issue, I want to handle the login details Ajaxly and not with normal form submission followed by redirects...
After some more rummaging around in SecureSocial code I got a better understanding of how it operates.
You can use any of the providers you listed in the play.plugins file seperatly to authenthicate the user's info from your own login/auth code. just make sure you send the right parameters that the provider needs.
I liked the way SecureSocial's ProviderController class dynamically decided what provider to use, based on a parameter. But I didn't like the responses it made - redirect.. I wanted to respond to an ajax request with some data and let the client side js handle it.
This is my solution:
pretty much copy all of ProviderController code to my own Auth.scala file (a Controller).
Changed the redirects related to "case ex, case _", kept the redirect on successful auth as it adds the SecureSocial session key related to the user.
Removed all the SecureSocial related routes from my routes file.
Put an additional hidden field with the logintype (userpass/google/fb/etc...) and configured my login ajax post to sent this along with the post to my Auth controller.
If you need more info comment here and I'll edit the answer.

Drupal 7 Ajax Forms

I am using Drupal 7, and I am building a web site, that has a contact form in the footer which should appear in every page. The requirements was to make this form work via Ajax, all examples I found on Internet was form that related to node.
So when I tried to apply the same concept, I faced the problem of rendering the form, so I have passed it to the template as a parameter like this:
$vars['node']->contactForm = drupal_get_form('nilecode_form');
When I render the form by using drupal_render_children($node->contactForm), all the fields were rendered but with no wrapping form tag.
So after frustration, and not very useful IRC chats, I am thinking to do it by using normal Ajax request.
Before doing so is there any solution, before doing it the bad way?
Thanks.
Take a look at my ajax form examples, the best way of achieving this is using a theme function for the form:
http://monchacos.com/monchacos/code/creating-forms-template-file-ajax-included
Theres an attachment in the post, so you can get the full code example.

Ajax generated content, crawling and black listing

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.

External HTML page, inside AJAX Iframe?

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.

Resources