21
frankblack
Re: Ajax calls directly from Jquery
  • 2009/8/20 17:40

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Quote:
But without its context, it will not give you too much things ...


... but it pushes me into the right direction.

Quote:
note, this part is important:

error_reporting(0);
@$xoopsLogger->activated = false;


Why? XOOPS debug conflicting with jquery? Or other reason?

22
hervet
Re: Ajax calls directly from Jquery
  • 2009/8/20 17:55

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


Quote:

frankblack wrote:
Why? XOOPS debug conflicting with jquery? Or other reason?

From your Php script, everything you display is part of the answer to the client (that's its return), so if you have activated the inline debug mode, it's part of the answer to the client.

That's why I found your debug mode using Firebug excellent

23
frankblack
Re: Ajax calls directly from Jquery
  • 2009/8/20 18:07

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


OK, I see. So one point for XAJAX, since you can disable debug there. Gulp! So I have to write a module without any error.

I hope the next core comes with some better debug modes. I use several options, but they are not "handy" for the "masses" I fear.

Another point for XAJAX: I don't have to care what to return. E.g. displaying html in a textarea. But I finally made it. So step by step I am progressing

24
frankblack
Re: Ajax calls directly from Jquery
  • 2009/8/20 21:10

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Hmmm, minor setback.

Someone here giving me a helping hand? My problem getting this realized with jquery, with xajax it was no problem for me.

An imagebar will be constructed from the contents of the database resp. what is called available player types.

Now I have to pass four different types of information to the js function to get the ajax call started: the id of the file, the player which is associated with the image I have to click on, a path and an extra for showing/hiding another div.

The portion of the image bar goes like this:
$imagebar .= '.DEBASER_URL.'/images/playericons/'.$iconstack[$thekey].'" onclick="xajax_xajaxinnerdisplay('.$id.', '.$xpidstack[$thekey].', '.$path.')'.$equal.'" alt="'.$namestack[$thekey].'" title="'.$namestack[$thekey].'" /> ';


I have no single clue how to do this...

25
frankblack
Re: Ajax calls directly from Jquery
  • 2009/8/21 8:00

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Little progress, but just jumping from one problem to another. I finally put the need values into the id.

$imagebar .= '.$id.'|'.$xpidstack[$thekey].'|'.$path.'|'.$equal.'" src="'.DEBASER_URL.'/images/playericons/'.$iconstack[$thekey].'" alt="'.$namestack[$thekey].'" title="'.$namestack[$thekey].'" /> ';


$(document).ready(function () {
$(
"img.innertrigger").click(function () {
var 
splitit this.id.split("|");
$(
"#showthecode").load("'.DEBASER_URL.'/ajaxed.php", { action "ajaxinner"part1 splitit[0], part2 splitit[1], part3 splitit[2], part4 splitit[3] });
});
});


So far so good, as the values get posted. But now in ajaxed.php the data have to be processed, a thickbox should be displayed AND if splitit[3] has a value an equalizer should be displayed. Yet I don't know how to solve this...

26
hervet
Re: Ajax calls directly from Jquery
  • 2009/8/21 8:51

  • hervet

  • Friend of XOOPS

  • Posts: 2267

  • Since: 2003/11/4


I'm not in your code (nor in your head) butI can give you some advices of how I use to do.

Put your "general" code in a .js file, call it, then from your Php script, pass some parameters to it like this (you create some kind of "dynamic" javascript code):
<script type="text/javascrip">
var 
myvar 'hello';
script>


then in your Js file, you simply use the var "myvar".
Is this what you need ?

If you are in Ajax, you can also pass some parameters to your Php script with several different maners.

Create an hidden field, use it as a container, set it's content dinamycally and push its value to your Php script.

27
kaotik
Re: Ajax calls directly from Jquery
  • 2009/8/21 9:05

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


I haven't tested this, but here's my sugestion:
1- Check what action was performed on the html page as it was passed to the ajax page. In this case "img.innertrigger".
You can either create another option or use one the the existing:
ajaxed.php
if ($_GET['action']=="ajaxinner"){
myFunction_img_innertrigger();
}

2- Now inside the php function place the following code:
<a href="#TB_inline?height=155&width=300&inlineId=hiddenModalContent&modal=true" class="thickbox">Show hidden modal content.a>

3- In your html page, in order for thickbox to work, place this code inside your javascript area:
$("img.innertrigger").live("click", function() {
tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
    
imgLoader = new Image();// preload image
    
imgLoader.src tb_pathToImage;
    });

What this does is bind a click action to any image called "innertrigger" that is present OR IN THE FUTURE! It means that javascript will work for ajaxed pieces.
Don't forget to include thickbox.js in your html page.

28
frankblack
Re: Ajax calls directly from Jquery
  • 2009/8/21 16:01

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


arrgll#!*? I don't get it. The thickbox pops up but remains empty. I am about to give up.

What I wrote must be total crap. How can I tell that the generated content in the php function is taken into the thickbox. My inabilities make my angry...

29
kaotik
Re: Ajax calls directly from Jquery
  • 2009/8/21 16:12

  • kaotik

  • Just can't stay away

  • Posts: 861

  • Since: 2004/2/19


frankblack: post your code, javascript and the ajax response and I'll take a look.

30
frankblack
Re: Ajax calls directly from Jquery
  • 2009/8/21 19:13

  • frankblack

  • Just can't stay away

  • Posts: 830

  • Since: 2005/6/13


Thx for the offer. I managed it ... nearly I have to click the button twice, which shows that js for the box loads too early, but I don't know how to remove that. I'll send you a pm otherwise the people burst out laughing about my code.

Login

Who's Online

191 user(s) are online (72 user(s) are browsing Support Forums)


Members: 0


Guests: 191


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Nov 30
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits