Welcome Guest, Not a member yet? Register   Sign In
Problem with jquery when i'm trying to remote
#1

[eluser]Ricola[/eluser]
hi there,

i'm trying to remote to controller with jquery but nothing respond back

this is my code (views)
Code:
$(function(){
    $("#commentForm").validate({
        rules: {
            email: {
                required: true,
                email:true,
                remote: "http://www.codeigniter.com/login/check"
            }
        }
});

and this controller
Code:
public function check()
{
     echo "false";
}

that's all i did but , actually this code work in the demo but i dont understand why it doesn't work with CI

i'm trying to search and answer in CI forums but it seems nothing work for me

this is a jquery validate that i'm using http://bassistance.de/jquery-plugins/jqu...alidation/



Thank you
#2

[eluser]Gerep[/eluser]
Are you using .htacces to take index.php?

Is no, you have to add index.php on your url.
#3

[eluser]Ricola[/eluser]
hi greep, i actually used .htaccess and i can access to controller by using url like this "http://www.codeigniter.com/login/check"

thanks

Ricola
#4

[eluser]Gerep[/eluser]
Take a look at your code on the browser and check if the javascript link is correct
#5

[eluser]Ricola[/eluser]
i checked at my code link and everything is ok( i think so)

Would u mind giving me a working code of your codeigniter by using jquery?
#6

[eluser]Gerep[/eluser]
This is a piece of code:

Code:
$.ajax({
                type: 'POST',
                url: 'http://www.tecnologia1.com.br/inicio/newsletter/',
                data: 'email='+$('#email').val(),
                success: function(return){
                                       if(return)
                                              alert('done');
                                       else
                                              alert('error');
                }
                }

The data
Code:
data: 'email='+$('#email').val(),

I what I receive on my newsletter method like:
Code:
$this->input->post('email');
#7

[eluser]Cristian Gilè[/eluser]
Quote:remote: "http://www.telltab.com/login/check"

index.php is missing. Are you using url rewrite to remove index.php from the URLs? Otherwise the url should be:

Code:
remote: "http://www.telltab.com/index.php/login/check"



EDIT: sorry, I posted my answer too late

Cristian Gilè
#8

[eluser]Cristian Gilè[/eluser]
Quote:
Code:
$(function(){
    $("#commentForm").validate({
        rules: {
            email: {
                required: true,
                email:true,
                remote: "http://www.codeigniter.com/login/check"
            }
        }
});

In the posted code a closing bracket is missing. It should be:

Code:
$(function(){
    $("#commentForm").validate({
        rules: {
            email: {
                required: true,
                email:true,
                remote: "http://www.codeigniter.com/login/check"
            }
        }
    });
});


Cristian Gilè
#9

[eluser]Ricola[/eluser]
thanks you for all suggestion

but i'm done with this jquery plugin Sad

actually i tried out by execute without codeigniter , everything work fine

but i don't know what exactly problem is , i use my posted code with codeigniter 2.0 everything respond except remote method.

required , email works fine but remote still not giving me a respond


thank you for ur fast reply Big Grin
#10

[eluser]Unknown[/eluser]
The quick solution is that if you are using JQuery 1.5.x, downgrade it to JQuery 1.4.x.

The reason is because JQuery 1.5.x has changed the way it uses ajax. In the validation plugin, the remote uses the ajax of JQuery (as long as I understand). A difference I have found is that in the URL is append a callback id. The problem is that it is passed through GET and you have to use it, but I don't know exactly why and how.

So, if any have a better idea or reason please post it. I think this is a regular problem and there's not yet a clear solution.




Theme © iAndrew 2016 - Forum software by © MyBB