ajax url and data question

I need to push a select option value onchange into a $_POST['value'] that is stored in BxWallModule.php

 

How do i put the path in a ajax url?

$.ajax({    

type:'POST',    

url: '../modules/boonex/wall/classes/BxWallModule.php', OR IS IT

url: 'http://www.mysite.com/modules/boonex/wall/classes/BxWallModule.php'

 

Any help is welcome :-)

Quote · 17 Feb 2014

 

I need to push a select option value onchange into a $_POST['value'] that is stored in BxWallModule.php

 

How do i put the path in a ajax url?

$.ajax({    

type:'POST',    

url: '../modules/boonex/wall/classes/BxWallModule.php', OR IS IT

url: 'http://www.mysite.com/modules/boonex/wall/classes/BxWallModule.php'

 

Any help is welcome :-)

The first is a path; and the ../ tells it to go up one in the directory.  If you need to load the path to the php file, then Dolphin has a variable that holds the Dolphin root; I don't know the exact form without looking.

The second one is a URL

Geeks, making the world a better place
Quote · 17 Feb 2014

BX_DIRECTORY_PATH_ROOT . 'modules/boonex/wall/classes/BxWallModule.php

or

BX_DIRECTORY_PATH_MODULES . 'boonex/wall/classes/BxWallModule.php

 

but I would like to ask if you are trying to run a function that is on the BxWallModule.php page. If so, what function is it because it would change the url.

caredesign.net
Quote · 17 Feb 2014

 

I need to push a select option value onchange into a $_POST['value'] that is stored in BxWallModule.php

 

How do i put the path in a ajax url?

$.ajax({    

type:'POST',    

url: '../modules/boonex/wall/classes/BxWallModule.php', OR IS IT

url: 'http://www.mysite.com/modules/boonex/wall/classes/BxWallModule.php'

 

Any help is welcome :-)

 
Ajax is used no differently then your browser. Both of those are wrong. You call the url the same way as the browser. You can't call it that way. The action point is part of the url.

So more like. http://www.mysite.com/m/wall/ or best to use the non-permalinked version http://www.mysite.com/modules/?r=wall/

But it most likely won't work. You just can't hand items to a module unless your entering a location of the module that is expecting them. So more specifics on what your trying to do would help.

https://www.deanbassett.com
Quote · 17 Feb 2014

thanx GG and Deano.

i am trying to get a html option value into the bxwallmodule variable with the ajax function

$outline_filtervalue = $_POST['outline_filter_val'];

this variable $outline_filtervalue i use to filter my outline.

the thing is that i have it all working when reload the whole index page. but i don't like that!

Quote · 17 Feb 2014

why not just reload that specific block and not the whole index page? IE, pass the filter variable as a GET and reload the block with that filter?

caredesign.net
Quote · 17 Feb 2014

 

why not just reload that specific block and not the whole index page? IE, pass the filter variable as a GET and reload the block with that filter?

 i use the loadDynamicBlock(858, '/index.php?dynamic=tab'); but i don't know how to use the Get . :-(

do you have a example for me..?

Quote · 17 Feb 2014

I have mine on an html template page, and it pulls the variables from the module page, but the same concept - -I believe:

 

<a href="__folder_url__Add-Current-Medication.php?client=__client_id__&block=__block_id__" class="top_members_menu" onclick="return !loadDynamicBlock(__block_id__, this.href);">Add Current Medication</a>

 Edit. In my version, I only have 2 (filters) - Current and Previous - Medications, so I just made each one a link. So, to make yours similar to mine I would guess it would be:

 

<a href="index.php?filter=__filter__&block=__block_id__" class="top_members_menu" onclick="return !loadDynamicBlock(__block_id__, this.href);">Whatever Filter</a>

 

This is what works for me and may not work for you. But I hope it points you in the right direction.

caredesign.net
Quote · 17 Feb 2014

<a href="index.php?filter=__filter__&block=__block_id__" class="top_members_menu" onclick="return !loadDynamicBlock(__block_id__, this.href);">Whatever Filter</a>

how do i give a array as part of the href?
the $modules = array(bx_videos) works if i put this as php code in the file.

i use that part in the function _getPostsOutline. that is located in the bxwallmodule file. 

Quote · 17 Feb 2014

 

how do i give a array as part of the href?

You don't. Arrays are a programming feature. Available in PHP, Javascript, C, ect. They cannot be passed as part of a url. Urls can only contain a list of single name/value pairs.


https://www.deanbassett.com
Quote · 17 Feb 2014

thank you that is good to know.

so is there a way to get my value into the php variable or should i go with a total different way..

How would i call the function _getPostsOutline that is located in the bxwallmodule and i need to give param to $amodules like

$aModules = 'bx_videos'

 

Quote · 17 Feb 2014

in this example

<a href="index.php?filter=__filter__&block=__block_id__" class="top_members_menu" onclick="return !loadDynamicBlock(__block_id__, this.href);">Whatever Filter</a>

the filter is being passed as part of the url. So if for example __filter__ is bx_videos the $_GET['filter'] will contain bx_videos.

Go to grab a option passed on the url and put it in the array, instead of this.

$aModules = 'bx_videos';

You would use something like this.

$aModules = $_GET['filter'];

https://www.deanbassett.com
Quote · 17 Feb 2014

 

$aModules = $_GET['filter'];

okay but in what file do i save this : $aModules = $_GET['filter'];
I need that in the bxwallmodule but if i save it there it doesn't do anything!

so do i need to put it in the index.php file then?

this is really nuts that i can't get it to work... grrrrr


 

Quote · 17 Feb 2014

Yes it would have to be in the index page as that is where the block is getting called. Not exactly the index page either. It would be the php script that the index page functions are in. Most likely bxbaseindexpageview or something like that. From there there has to be be code that loads the block, so then that value would passed to the module from there.

Yes, coding is not exactly easy to do. It takes most of us years to learn how dolphin is put together.

https://www.deanbassett.com
Quote · 17 Feb 2014

I give up!!

thanx for all the help and i hope that 7.1.5 has this feature by default as i think that to filter the outline / timeline by module events is really handy.

so i stick by reload index page for now... :-(
if someone is willing to give it a go and get it to work please inform me...

i'm moving on to the next cool thing

Quote · 18 Feb 2014

lol - you jinxed me. I got a call for a Book mod. Not writing books, but adding books, like adding sites. I was using the groups for Books, Movies, Audio, And videos in a module I named Resources - just a copy of the groups module. But after seeing the various items that get added, I needed a better way. So, I started using the Sites module. Liked the way that it is set up, so now working on one for Books. So far, I have it to where a user enters a Book name, and it searches using Google Books API for that book.

Then I get stuck where you are at. After a book name is entered, it will return up to 6 of the closest matches. But, I do not want it to refresh the page to display the results, which it is doing now.

caredesign.net
Quote · 18 Feb 2014

still work in prgress.. couldn't let it go!
i've gor the java script call working... all i need to know now is how too read a $variable from one php file (1) into another when i call a function. mind you that the $variable is updated before i call the function in php file (2)
it's crazy but but even a global $variable stays empty..

So super PHP minds... can you help me out here.

 

Quote · 20 Feb 2014

It depends on how your calling the function. Values have to be passed from one to the other somehow. And without know how one function is being called by the other it's not going to be possible to tell you how to do it.

Most of the time for ajax you have to pass the value on the url as part of the ajax call which will then be in a $_GET variable which the called ajax function can read.

https://www.deanbassett.com
Quote · 20 Feb 2014

I am guessing it's a ajax call because you said globals are empty. Globals are only available to be read from other functions within the same script if the script is the same copy. Meaning if you call a function within that script, but use ajax to call it, you are technically running a second copy of the script. You have not remained within the same thread, so the globals are not available.

You could look into using sessions. It may solve your issue. But without knowing the code your using i can't be more precise on how you need to do it.

https://www.deanbassett.com
Quote · 20 Feb 2014

 

I am guessing it's a ajax call because you said globals are empty. Globals are only available to be read from other functions within the same script if the script is the same copy. Meaning if you call a function within that script, but use ajax to call it, you are technically running a second copy of the script. You have not remained within the same thread, so the globals are not available.

You could look into using sessions. It may solve your issue. But without knowing the code your using i can't be more precise on how you need to do it.

yes i did not make myself clear here.. sorry.
yes i think i will try the session part. let you know my progress :-)

short discr. i run script ajax from index page after html select (option) value is then send to a php file (call it test for now). then i run a function in other php file (bxwallmodule) and i wanna read the value from the first file and want to use it in function in 2ns php file. it sounds so simple but yet i am stuck for 3 days now!! mainly due to the fact that i know jack of php i guess lol.

 

Quote · 20 Feb 2014
 
 
Below is the legacy version of the Boonex site, maintained for Dolphin.Pro 7.x support.
The new Dolphin solution is powered by UNA Community Management System.