Welcome Guest, Not a member yet? Register   Sign In
POST empty when called from another method
#11

[eluser]Flemming[/eluser]
I might be wrong but ... I think it's impossible!

but if it is impossible, could you perhaps call the love_this method from your other method and pass it the post data as a variable? eg:

Code:
function some_function()
{
  // do some stuff here, then call the love_this method
  $this->love_this($this->input->post('url'));
}
#12

[eluser]sico87[/eluser]
how would I then call the love_this method from my html link what would href be if the controller is called home?
#13

[eluser]Flemming[/eluser]
so... let me see if i'm understanding this correctly

you want an html anchor that when clicked will call your jquery which will post the href to your love_this method?

or

you want an html anchor that when clicked will call your jquery which will post the href to some other method which will then in turn call your love_this method?

think I've lost your plot!
#14

[eluser]danmontgomery[/eluser]
Doesn't work that way...

You're submitting a POST via javascript. You can't manipulate PHP variables with javascript because PHP is executed server side (before the page is displayed) and javascript is executed client side (after the page is displayed). There is no case in which you can directly manipulate anything PHP can access with Javascript, because you can't travel back in time.
#15

[eluser]Flemming[/eluser]
you can use Javascript to POST data to PHP ... AJAX! :-)
#16

[eluser]sico87[/eluser]
Think I have lost the plot too,

Basically the user clicks on a link that calls the method get_content_abstract, this is done via ajax and in that ajax there is some data that gets sent the post, part of this is data is needed so I can do some checks in the love_this method.

So the users clicks a link and some content is called from a database via ajax, if the user likes the content they click the link that calls the love_this method, the love this method needs to be able to access the POST so that it can get the contents_id which is stored in the POST.


Does that make sense?
#17

[eluser]danmontgomery[/eluser]
[quote author="Flemming" date="1263327913"]you can use Javascript to POST data to PHP ... AJAX! :-)[/quote]

Yes, in which case you are in essence opening a new browser window, submitting a form to that page, then returning the result to the javascript on the first page. You can't access any PHP on the original page with javascript, which is what he's trying to do.
#18

[eluser]sico87[/eluser]
Ah right I am a plonker, sorted it out I was over complicating it, never need to POST data again, if I put the love this link in the same view as where the content gets put.



Thank you for all your help Flemming wouldn't of worked it out without you
#19

[eluser]Flemming[/eluser]
glad you got it sorted! :-)




Theme © iAndrew 2016 - Forum software by © MyBB