Welcome Guest, Not a member yet? Register   Sign In
load a view php with ajax on a div
#1

Hello Pals

i try load a view with ajax but innerhtml command has an error :

Fatal error: Using $this when not in object context in C:\xampp\htdocs\application\views\signuppanel.php on line 3
Undecided

How can i load this php? do you any example page for this ?

if you want to see this error i linked my project on google drive
you click signup button for error.

google drive proje Link

thnx
Reply
#2

Without seeing your code it is hard to say, but I am guessing, you are not fully initializing the CI framework before accessing the view.

Is this correct?

Do you have a special controller for the Ajax requests?
Reply
#3

(11-14-2014, 09:05 AM)Chroma Wrote: Without seeing your code it is hard to say, but I am guessing, you are not fully initializing the CI framework before accessing the view.

Is this correct?

Do you have a special controller for the Ajax requests?

Thanks for answer.

I attached a link to my code at my previous message. You can check from there.

About ajax: yes I have a special controller for requests.

I don't know about framework, is it fully installed or not? How can I check it?

By the way, as I said before, you can check the code from link. Download it and check from localhost. Try yourself please.

Thank you!
Reply
#4

(11-14-2014, 09:05 AM)Chroma Wrote: Without seeing your code it is hard to say, but I am guessing, you are not fully initializing the CI framework before accessing the view.

Is this correct?

Do you have a special controller for the Ajax requests?

Thanks for answer.

I attached a link to my code at my previous message. You can check from there.

About ajax: yes I have a special controller for requests.

I don't know about framework, is it fully installed or not? How can I check it?

By the way, as I said before, you can check the code from link.
https://docs.google.com/file/d/0B88OtgNi...xxTzA/edit
Download it and check from localhost. Try yourself please.

Thank you!
Reply
#5

I would recommend to put the files somewhere in raw format instead of a download.

From the errror you try to use $this inside your view without a proper object. So maybe the view and the coresponding controller would be usefull to see (post it her inside a code bracket).

Reply
#6

This issue has already been fixed on IRC.

He tried to $this->lang->line("key"); from within the view. Solution was to load the language helper and use the function lang() from the helper.
Reply
#7

@slax0r: thx for feedback .. tilt it out of my mind ;o)

Reply
#8

(11-17-2014, 03:45 AM)Rufnex Wrote: I would recommend to put the files somewhere in raw format instead of a download.

From the errror you try to use $this inside your view without a proper object. So maybe the view and the coresponding controller would be usefull to see (post it her inside a code bracket).

hi
i attached my code.
 if i load signuppanel.php its working good but i load via ajax its not found lang() function.
thnx again
Reply
#9

As it has been already said on IRC, you are not loading the language helper in the right point.

All AJAX requests most go through the controller/model/view as all other normal request. An AJAX request is in its base exactly the same as if you would type in an URL in the browser. Unless you are sending some POST data over with AJAX, but even then, it is the same.

So, if you call an URL like: http://yoursite.com/index.php/User/SignUp this means, that you are calling controller "User" and method "SignUp". It is in this controllers constructor method (public function __construct()) or in the controller method SignUp, where you must load the language helper with $this->load->helper("language");. Or, if you are using the language helper more frequently on more than this one view, you may want to add it to "application/config/autoload.php", where you add the "language" to the $autoload["helper"] array, like this:
Code:
$autoload["helper"] = array("language");

You must never call the view directly, the request must always go through a controller method. If you call it directly, there is nothing from CodeIgniter available there.
Reply
#10

(11-17-2014, 03:48 AM)slax0r Wrote: This issue has already been fixed on IRC.

He tried to $this->lang->line("key"); from within the view. Solution was to load the language helper and use the function lang() from the helper.

Thank you for the feedback and understanding of the issue.
Reply




Theme © iAndrew 2016 - Forum software by © MyBB